Skip to content

Commit abd8c12

Browse files
committed
No longer using short paths for launch.lua path passed to the dll.
- This was causing problems when SimpleGraphic was comparing this short path to its own (non-short) path.
1 parent 190614f commit abd8c12

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

Launcher.cpp

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
#include "SafeHandle.h"
88
#include "StringUtils.h"
99

10+
// Enable if the launcher should convert the path of the launch.lua to a "short" windows path.
11+
// This caused an issue with how SimpleGraphic.dll compares the path to its own, so settings and builds weren't found,
12+
// so it's disabled for now.
13+
constexpr auto USE_SHORT_PATHS = false;
14+
1015
std::vector<std::wstring> ParseCommandLine()
1116
{
1217
std::vector<std::wstring> commandLine;
@@ -72,22 +77,30 @@ bool IsValidLuaFile(const std::wstring &path, std::string &firstLine)
7277
return true;
7378
}
7479

75-
bool InsertPath(std::vector<std::wstring> &commandLine, std::wstring path)
80+
bool InsertPath(std::vector<std::wstring> &commandLine, const std::wstring &path)
7681
{
77-
DWORD requiredLength = GetShortPathName(path.c_str(), nullptr, 0);
78-
if (requiredLength == 0)
82+
if constexpr (USE_SHORT_PATHS)
7983
{
80-
return false;
81-
}
84+
DWORD requiredLength = GetShortPathName(path.c_str(), nullptr, 0);
85+
if (requiredLength == 0)
86+
{
87+
return false;
88+
}
89+
90+
std::wstring shortPath(requiredLength, L'\0');
91+
requiredLength = GetShortPathName(path.c_str(), shortPath.data(), requiredLength);
92+
if (requiredLength == 0)
93+
{
94+
return false;
95+
}
8296

83-
std::wstring shortPath(requiredLength, L'\0');
84-
requiredLength = GetShortPathName(path.c_str(), shortPath.data(), requiredLength);
85-
if (requiredLength == 0)
97+
commandLine.insert(commandLine.begin() + 1, shortPath);
98+
}
99+
else
86100
{
87-
return false;
101+
commandLine.insert(commandLine.begin() + 1, path);
88102
}
89-
90-
commandLine.insert(commandLine.begin() + 1, shortPath);
103+
return true;
91104
}
92105

93106
bool FindLaunchLua(std::wstring basePath, std::vector<std::wstring> &commandLine, std::string &firstLine)

0 commit comments

Comments
 (0)