The open source OpenXR runtime

gui: Fix layout file not being created for the first time on Windows

By ensuring imgui.ini exists.
Also enabled u_config_json_open_or_create_file for Windows as this OS has an
implementation of u_file_get_path_in_config_dir available now.

authored by

Mateo de Mayo and committed by
Moses Turner
3d366b92 bd265c61

+13 -1
+1 -1
src/xrt/auxiliary/util/u_config_json.c
··· 44 44 u_config_json_open_or_create_file(struct u_config_json *json, const char *filename) 45 45 { 46 46 json->file_loaded = false; 47 - #if defined(XRT_OS_LINUX) && !defined(XRT_OS_ANDROID) 47 + #if (defined(XRT_OS_LINUX) || defined(XRT_OS_WINDOWS)) && !defined(XRT_OS_ANDROID) 48 48 char tmp[1024]; 49 49 ssize_t ret = u_file_get_path_in_config_dir(filename, tmp, sizeof(tmp)); 50 50 if (ret <= 0) {
+6
src/xrt/targets/gui/gui_sdl2_imgui.c
··· 60 60 assert(res > 0); 61 61 io->IniFilename = p->layout_file; 62 62 63 + // Ensure imgui.ini file exists in config dir 64 + FILE *imgui_ini = u_file_open_file_in_config_dir("imgui.ini", "a"); 65 + if (imgui_ini != NULL) { 66 + fclose(imgui_ini); 67 + } 68 + 63 69 // Setup Platform/Renderer bindings 64 70 igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx); 65 71 igImGui_ImplOpenGL3_Init(NULL);
+6
src/xrt/targets/openxr/oxr_sdl2_hack.c
··· 150 150 assert(res > 0); 151 151 io->IniFilename = p->layout_file; 152 152 153 + // Ensure imgui.ini file exists in config dir 154 + FILE *imgui_ini = u_file_open_file_in_config_dir("imgui.ini", "a"); 155 + if (imgui_ini != NULL) { 156 + fclose(imgui_ini); 157 + } 158 + 153 159 // Setup Platform/Renderer bindings 154 160 igImGui_ImplSDL2_InitForOpenGL(p->win, p->ctx); 155 161 igImGui_ImplOpenGL3_Init(NULL);