From d2795b92b02253a36cb7406fbaeabdef6d7caa19 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 9 Jun 2019 14:35:27 +0300 Subject: [PATCH 1/1] Invent a value for argv[0] if not present Gdbserver seems to pass an empty argv[0], at least on Windows. That causes problems with the various get_*_dir functions. --- source/core/application.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/core/application.cpp b/source/core/application.cpp index 1bae2cd..aedaa4b 100644 --- a/source/core/application.cpp +++ b/source/core/application.cpp @@ -90,6 +90,15 @@ void Application::set_startup_info(const char *argv0, void *data) static FS::Path exe; + if(!argv0 || !*argv0) + { +#ifdef _WIN32 + argv0 = "application.exe"; +#else + argv0 = "./application"; +#endif + } + bool has_slash = strchr(argv0, FS::DIRSEP); if(!has_slash) exe = FS::path_lookup(argv0); -- 2.43.0