fixes to new save system
parent
fc76531ca1
commit
7ada40c1bc
|
@ -985,17 +985,26 @@ DOC_SEE(Buffer_Create_Flag)
|
|||
String fname = make_string(filename, filename_len);
|
||||
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
if (filename != 0){
|
||||
Editing_File_Canon_Name canon;
|
||||
|
||||
if (get_canon_name(system, &canon, fname)){
|
||||
Editing_File *file = working_set_canon_contains(working_set, canon.name);
|
||||
|
||||
if (file == 0){
|
||||
Editing_File *file = 0;
|
||||
b32 do_new_file = false;
|
||||
|
||||
Plat_Handle handle = {0};
|
||||
|
||||
Editing_File_Canon_Name canon = {0};
|
||||
if (get_canon_name(system, &canon, fname)){
|
||||
file = working_set_canon_contains(working_set, canon.name);
|
||||
}
|
||||
else{
|
||||
do_new_file = true;
|
||||
}
|
||||
|
||||
if (!file){
|
||||
file = working_set_name_contains(working_set, fname);
|
||||
}
|
||||
|
||||
if (!file){
|
||||
if (!do_new_file){
|
||||
if (flags & BufferCreate_AlwaysNew){
|
||||
do_new_file = true;
|
||||
}
|
||||
|
@ -1004,6 +1013,7 @@ DOC_SEE(Buffer_Create_Flag)
|
|||
do_new_file = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!do_new_file){
|
||||
Assert(!handle_equal(handle, handle_zero()));
|
||||
|
@ -1047,7 +1057,6 @@ DOC_SEE(Buffer_Create_Flag)
|
|||
fill_buffer_summary(&result, file, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
|
||||
return(result);
|
||||
|
|
|
@ -1022,14 +1022,12 @@ file_create_from_string(System_Functions *system, Models *models,
|
|||
|
||||
i32 scratch_size = partition_remaining(part);
|
||||
Assert(scratch_size > 0);
|
||||
|
||||
b32 init_success = buffer_end_init(&init, part->base + part->pos, scratch_size);
|
||||
AllowLocal(init_success); Assert(init_success);
|
||||
|
||||
if (buffer_size(&file->state.buffer) < val.size){
|
||||
file->settings.dos_write_mode = 1;
|
||||
}
|
||||
|
||||
file_synchronize_times(system, file);
|
||||
|
||||
i16 font_id = models->global_font.font_id;
|
||||
|
@ -1037,6 +1035,7 @@ file_create_from_string(System_Functions *system, Models *models,
|
|||
Render_Font *font = get_font_info(font_set, font_id)->font;
|
||||
float *advance_data = 0;
|
||||
if (font) advance_data = font->advance_data;
|
||||
|
||||
file_measure_starts_widths(system, general, &file->state.buffer, advance_data);
|
||||
|
||||
file->settings.read_only = read_only;
|
||||
|
|
|
@ -1281,7 +1281,7 @@ Sys_Save_File_Sig(system_save_file){
|
|||
GENERIC_WRITE,
|
||||
0,
|
||||
0,
|
||||
CREATE_NEW,
|
||||
CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
0);
|
||||
|
||||
|
@ -1298,6 +1298,8 @@ Sys_Save_File_Sig(system_save_file){
|
|||
}
|
||||
written_total += written_size;
|
||||
}
|
||||
|
||||
CloseHandle(file);
|
||||
}
|
||||
|
||||
return(result);
|
||||
|
|
Loading…
Reference in New Issue