Skip to content

Commit 0114069

Browse files
authored
Merge pull request #4 from Wires77/fix_debugger
Load lua library for debugging in dev mode
2 parents abd8c12 + a9d548c commit 0114069

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Launcher.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,21 @@ bool InsertLaunchLua(std::vector<std::wstring> &commandLine, std::string &firstL
247247
return false;
248248
}
249249

250+
bool isDevScript(std::wstring scriptPath)
251+
{
252+
const auto finalSlash = scriptPath.find_last_of(L'\\');
253+
if (finalSlash == std::wstring::npos || finalSlash == 0)
254+
{
255+
return false;
256+
}
257+
const auto nextToLastSlash = scriptPath.find_last_of(L'\\', finalSlash - 1);
258+
if (nextToLastSlash == std::wstring::npos)
259+
{
260+
return false;
261+
}
262+
return scriptPath.compare(nextToLastSlash + 1, finalSlash - 1 - nextToLastSlash, L"src") == 0;
263+
}
264+
250265
std::vector<std::string> ConvertToACP(std::vector<std::wstring> commandLine)
251266
{
252267
std::vector<std::string> commandLineACP;
@@ -303,6 +318,10 @@ int CALLBACK wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
303318
dllName += L".dll";
304319
}
305320

321+
if (isDevScript(commandLine[1])) {
322+
LoadLibrary(L"lua51.dll");
323+
}
324+
306325
// Load the DLL
307326
HMODULE hDLL = LoadLibrary(dllName.c_str());
308327
if (hDLL == nullptr)

0 commit comments

Comments
 (0)