MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / IsProblematicWorkingDirectory

Function IsProblematicWorkingDirectory

src/Platform_Windows.c:1188–1204  ·  view source on GitHub ↗

Detects if the game is running in Windows directory */ This happens when ClassiCube is launched directly from shell process */ (e.g. via clicking a search result in Windows 10 start menu) */

Source from the content-addressed store, hash-verified

1186/* This happens when ClassiCube is launched directly from shell process */
1187/* (e.g. via clicking a search result in Windows 10 start menu) */
1188static cc_bool IsProblematicWorkingDirectory(void) {
1189 cc_string curDir, winDir;
1190 char curPath[2048] = { 0 };
1191 char winPath[2048] = { 0 };
1192
1193 GetCurrentDirectoryA(2048, curPath);
1194 GetSystemDirectoryA(winPath, 2048);
1195
1196 curDir = String_FromReadonly(curPath);
1197 winDir = String_FromReadonly(winPath);
1198
1199 if (String_Equals(&curDir, &winDir)) {
1200 Platform_LogConst("Working directory is System32! Changing to executable directory..");
1201 return true;
1202 }
1203 return false;
1204}
1205
1206cc_result Platform_SetDefaultCurrentDirectory(int argc, char** argv) {
1207 cc_winstring path;

Callers 1

Calls 3

String_FromReadonlyFunction · 0.85
String_EqualsFunction · 0.85
Platform_LogConstFunction · 0.85

Tested by

no test coverage detected