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,25 +157,25 @@ 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
String str = {0};
if (config_string_var(parsed, "extensions", 0, &str)){
parse_extension_line_to_extension_list(str, &project->extension_list);
}
bool32 open_recursively = false;
if (config_bool_var(parsed, "open_recursively", 0, &open_recursively)){
project->open_recursively = open_recursively;
}
// Read the settings from project.4coder
String str = {0};
if (config_string_var(parsed, "extensions", 0, &str)){
parse_extension_line_to_extension_list(str, &project->extension_list);
}
bool32 open_recursively = false;
if (config_bool_var(parsed, "open_recursively", 0, &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"
#elif defined(IS_LINUX) #elif defined(IS_LINUX)
@ -185,43 +185,43 @@ parse_project__data(Partition *scratch, String file_name, String data, String fi
#else #else
# 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){
Config_Compound *compound = 0;
if (config_compound_var(parsed, FKEY_COMMAND, i, &compound)){
Fkey_Command *command = &project->fkey_commands[i - 1];
command->command[0] = 0;
command->out[0] = 0;
command->use_build_panel = false;
command->save_dirty_buffers = false;
String cmd = {0}; for (int32_t i = 1; i <= 16; ++i){
if (config_compound_string_member(parsed, compound, "cmd", 0, &cmd)){ Config_Compound *compound = 0;
String dst = make_fixed_width_string(command->command); if (config_compound_var(parsed, FKEY_COMMAND, i, &compound)){
append(&dst, cmd); Fkey_Command *command = &project->fkey_commands[i - 1];
terminate_with_null(&dst); command->command[0] = 0;
} command->out[0] = 0;
command->use_build_panel = false;
String out = {0}; command->save_dirty_buffers = false;
if (config_compound_string_member(parsed, compound, "out", 1, &out)){
String dst = make_fixed_width_string(command->out); String cmd = {0};
append(&dst, out); if (config_compound_string_member(parsed, compound, "cmd", 0, &cmd)){
terminate_with_null(&out); String dst = make_fixed_width_string(command->command);
} append(&dst, cmd);
terminate_with_null(&dst);
bool32 footer_panel = false; }
if (config_compound_bool_member(parsed, compound, "footer_panel", 2, &footer_panel)){
command->use_build_panel = footer_panel; String out = {0};
} if (config_compound_string_member(parsed, compound, "out", 1, &out)){
String dst = make_fixed_width_string(command->out);
bool32 save_dirty_buffers = false; append(&dst, out);
if (config_compound_bool_member(parsed, compound, "save_dirty_files", 3, &footer_panel)){ terminate_with_null(&out);
command->save_dirty_buffers = save_dirty_buffers; }
bool32 footer_panel = false;
if (config_compound_bool_member(parsed, compound, "footer_panel", 2, &footer_panel)){
command->use_build_panel = footer_panel;
}
bool32 save_dirty_buffers = false;
if (config_compound_bool_member(parsed, compound, "save_dirty_files", 3, &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);