From 61247f885ca747f25d5ed6a809194b53bef95ca2 Mon Sep 17 00:00:00 2001 From: Rene Thrane Date: Thu, 11 Sep 2025 17:42:08 +0200 Subject: [PATCH] Made the startup script more resilient for platforms that don't supply a path for the executable. --- .../FslDemoPlatform/Configuration/Console/DemoMain.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DemoFramework/FslDemoPlatform/source/FslDemoPlatform/Configuration/Console/DemoMain.cpp b/DemoFramework/FslDemoPlatform/source/FslDemoPlatform/Configuration/Console/DemoMain.cpp index 3a7b1df91b..d212074397 100644 --- a/DemoFramework/FslDemoPlatform/source/FslDemoPlatform/Configuration/Console/DemoMain.cpp +++ b/DemoFramework/FslDemoPlatform/source/FslDemoPlatform/Configuration/Console/DemoMain.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,12 @@ int main(int argc, char* argv[]) if (argc >= 1 && argv[0] != nullptr) { strContentPath = Fsl::IO::Path::GetDirectoryName(argv[0]); + if (strContentPath.IsEmpty()) + { + FSLLOG3_WARNING_IF(strContentPath.IsEmpty(), + "could not get directory information from the exe file argument: '{}', trying to use '.' to resolve it", argv[0]) + strContentPath = "."; + } } else { @@ -55,7 +62,8 @@ int main(int argc, char* argv[]) FSLLOG3_WARNING("Could not find the exe path, trying to use current working directory instead."); } - strContentPath = Fsl::IO::Path::GetFullPath(strContentPath); + // Only try to resolve the full path if we have a path to begin with. + strContentPath = !strContentPath.IsEmpty() ? Fsl::IO::Path::GetFullPath(strContentPath) : strContentPath; strPersistentPath = strContentPath; strContentPath = Fsl::IO::Path::Combine(strContentPath, "Content");