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

Function Platform_SetDefaultCurrentDirectory

src/Platform_Windows.c:1206–1225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204}
1205
1206cc_result Platform_SetDefaultCurrentDirectory(int argc, char** argv) {
1207 cc_winstring path;
1208 int i, len;
1209 cc_result res;
1210 if (!IsProblematicWorkingDirectory()) return 0;
1211
1212 res = Process_RawGetExePath(&path, &len);
1213 if (res) return res;
1214 if (!path.uni[0]) return ERR_NOT_SUPPORTED;
1215 /* Not implemented on ANSI only systems due to laziness */
1216
1217 /* Get rid of filename at end of directory */
1218 for (i = len - 1; i >= 0; i--, len--)
1219 {
1220 if (path.uni[i] == '/' || path.uni[i] == '\\') break;
1221 }
1222
1223 path.uni[len] = '\0';
1224 return SetCurrentDirectoryW(path.uni) ? 0 : GetLastError();
1225}
1226#endif

Callers

nothing calls this directly

Calls 2

Process_RawGetExePathFunction · 0.70

Tested by

no test coverage detected