From: Mikko Rasa Date: Sun, 9 Jun 2019 11:35:27 +0000 (+0300) Subject: Invent a value for argv[0] if not present X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d2795b92b02253a36cb7406fbaeabdef6d7caa19;p=libs%2Fcore.git 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. --- 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);