fixed linux current directory compile bug

master
Allen Webster 2017-07-19 16:13:38 -04:00
parent 5bb69d6d96
commit 850b5dd5d4
2 changed files with 15 additions and 1 deletions

View File

@ -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);

View File

@ -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);