Fixed a problem with project parsing

master
Allen Webster 2018-05-20 23:12:08 -07:00
parent ad922fb5ee
commit 70160d16dc
1 changed files with 53 additions and 53 deletions

View File

@ -75,7 +75,7 @@ close_all_files_with_extension(Application_Links *app, Partition *scratch_part,
static void static void
open_all_files_in_directory_with_extension__inner(Application_Links *app, String space, open_all_files_in_directory_with_extension__inner(Application_Links *app, String space,
CString_Array extension_array, CString_Array extension_array,
uint32_t flags){ uint32_t flags){
File_List list = get_file_list(app, space.str, space.size); File_List list = get_file_list(app, space.str, space.size);
int32_t dir_size = space.size; int32_t dir_size = space.size;
@ -157,24 +157,24 @@ parse_project__data(Partition *scratch, String file_name, String data, String fi
project->loaded = true; project->loaded = true;
// Set new project directory // Set new project directory
{ {
project->dir = project->dir_space; project->dir = project->dir_space;
String str = make_fixed_width_string(project->dir_space); String str = make_fixed_width_string(project->dir_space);
copy(&str, file_dir); copy(&str, file_dir);
terminate_with_null(&str); terminate_with_null(&str);
project->dir_len = str.size; project->dir_len = str.size;
} }
// Read the settings from project.4coder // Read the settings from project.4coder
String str = {0}; String str = {0};
if (config_string_var(parsed, "extensions", 0, &str)){ if (config_string_var(parsed, "extensions", 0, &str)){
parse_extension_line_to_extension_list(str, &project->extension_list); parse_extension_line_to_extension_list(str, &project->extension_list);
} }
bool32 open_recursively = false; bool32 open_recursively = false;
if (config_bool_var(parsed, "open_recursively", 0, &open_recursively)){ if (config_bool_var(parsed, "open_recursively", 0, &open_recursively)){
project->open_recursively = open_recursively; project->open_recursively = open_recursively;
} }
#if defined(IS_WINDOWS) #if defined(IS_WINDOWS)
# define FKEY_COMMAND "fkey_command_win" # define FKEY_COMMAND "fkey_command_win"
@ -186,42 +186,42 @@ parse_project__data(Partition *scratch, String file_name, String data, String fi
# error no project configuration names for this platform # error no project configuration names for this platform
#endif #endif
for (int32_t i = 1; i <= 16; ++i){ for (int32_t i = 1; i <= 16; ++i){
Config_Compound *compound = 0; Config_Compound *compound = 0;
if (config_compound_var(parsed, FKEY_COMMAND, i, &compound)){ if (config_compound_var(parsed, FKEY_COMMAND, i, &compound)){
Fkey_Command *command = &project->fkey_commands[i - 1]; Fkey_Command *command = &project->fkey_commands[i - 1];
command->command[0] = 0; command->command[0] = 0;
command->out[0] = 0; command->out[0] = 0;
command->use_build_panel = false; command->use_build_panel = false;
command->save_dirty_buffers = false; command->save_dirty_buffers = false;
String cmd = {0}; String cmd = {0};
if (config_compound_string_member(parsed, compound, "cmd", 0, &cmd)){ if (config_compound_string_member(parsed, compound, "cmd", 0, &cmd)){
String dst = make_fixed_width_string(command->command); String dst = make_fixed_width_string(command->command);
append(&dst, cmd); append(&dst, cmd);
terminate_with_null(&dst); terminate_with_null(&dst);
} }
String out = {0}; String out = {0};
if (config_compound_string_member(parsed, compound, "out", 1, &out)){ if (config_compound_string_member(parsed, compound, "out", 1, &out)){
String dst = make_fixed_width_string(command->out); String dst = make_fixed_width_string(command->out);
append(&dst, out); append(&dst, out);
terminate_with_null(&out); terminate_with_null(&out);
} }
bool32 footer_panel = false; bool32 footer_panel = false;
if (config_compound_bool_member(parsed, compound, "footer_panel", 2, &footer_panel)){ if (config_compound_bool_member(parsed, compound, "footer_panel", 2, &footer_panel)){
command->use_build_panel = footer_panel; command->use_build_panel = footer_panel;
} }
bool32 save_dirty_buffers = false; bool32 save_dirty_buffers = false;
if (config_compound_bool_member(parsed, compound, "save_dirty_files", 3, &footer_panel)){ if (config_compound_bool_member(parsed, compound, "save_dirty_files", 3, &save_dirty_buffers)){
command->save_dirty_buffers = save_dirty_buffers; command->save_dirty_buffers = save_dirty_buffers;
}
}
} }
} }
} }
}
}
return(parsed); return(parsed);
} }
@ -302,7 +302,7 @@ set_current_project(Application_Links *app, Partition *scratch, Project *project
static void static void
set_current_project_from_data(Application_Links *app, Partition *scratch, set_current_project_from_data(Application_Links *app, Partition *scratch,
String file_name, String data, String file_dir){ String file_name, String data, String file_dir){
Temp_Memory temp = begin_temp_memory(scratch); Temp_Memory temp = begin_temp_memory(scratch);
Project project = {0}; Project project = {0};
Config *parsed = parse_project__data(scratch, file_name, data, file_dir, &project); Config *parsed = parse_project__data(scratch, file_name, data, file_dir, &project);