|
7 | 7 | #include "SafeHandle.h"
|
8 | 8 | #include "StringUtils.h"
|
9 | 9 |
|
| 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 | + |
10 | 15 | std::vector<std::wstring> ParseCommandLine()
|
11 | 16 | {
|
12 | 17 | std::vector<std::wstring> commandLine;
|
@@ -72,22 +77,30 @@ bool IsValidLuaFile(const std::wstring &path, std::string &firstLine)
|
72 | 77 | return true;
|
73 | 78 | }
|
74 | 79 |
|
75 |
| -bool InsertPath(std::vector<std::wstring> &commandLine, std::wstring path) |
| 80 | +bool InsertPath(std::vector<std::wstring> &commandLine, const std::wstring &path) |
76 | 81 | {
|
77 |
| - DWORD requiredLength = GetShortPathName(path.c_str(), nullptr, 0); |
78 |
| - if (requiredLength == 0) |
| 82 | + if constexpr (USE_SHORT_PATHS) |
79 | 83 | {
|
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 | + } |
82 | 96 |
|
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 |
86 | 100 | {
|
87 |
| - return false; |
| 101 | + commandLine.insert(commandLine.begin() + 1, path); |
88 | 102 | }
|
89 |
| - |
90 |
| - commandLine.insert(commandLine.begin() + 1, shortPath); |
| 103 | + return true; |
91 | 104 | }
|
92 | 105 |
|
93 | 106 | bool FindLaunchLua(std::wstring basePath, std::vector<std::wstring> &commandLine, std::string &firstLine)
|
|
0 commit comments