| 1204 | } |
| 1205 | |
| 1206 | cc_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 |
nothing calls this directly
no test coverage detected