From 850b5dd5d4e13c48a4bbde4a27ffc494d80249f1 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 19 Jul 2017 16:13:38 -0400 Subject: [PATCH] fixed linux current directory compile bug --- platform_linux/linux_4ed.cpp | 10 ++++++++++ platform_win32/win32_4ed.cpp | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/platform_linux/linux_4ed.cpp b/platform_linux/linux_4ed.cpp index 87d3974a..6240bea7 100644 --- a/platform_linux/linux_4ed.cpp +++ b/platform_linux/linux_4ed.cpp @@ -1760,6 +1760,16 @@ main(int argc, char **argv){ XAddConnectionWatch(linuxvars.XDisplay, &LinuxX11ConnectionWatch, NULL); + char cwd[4096]; + u32 size = sysfunc.get_current_path(cwd, sizeof(cwd)); + if (size == 0 || size >= sizeof(cwd)){ + system_error_box("Could not get current directory at launch."); + } + String curdir = make_string(cwd, size); + terminate_with_null(&curdir); + replace_char(&curdir, '\\', '/'); + + LOG("Initializing application variables\n"); app.init(&sysfunc, &target, &memory_vars, linuxvars.clipboard_contents, current_directory, custom_api); LinuxResizeTarget(window_width, window_height); diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index cf67b730..728a92e3 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -1185,7 +1185,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS Assert(win32vars.count_per_usecond > 0.f); // - // Main Loop + // App init // char cwd[4096]; @@ -1200,6 +1200,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS LOG("Initializing application variables\n"); app.init(&sysfunc, &target, &memory_vars, win32vars.clipboard_contents, curdir, custom_api); + // + // Main loop + // + b32 keep_running = true; win32vars.first = true; timeBeginPeriod(1);