| 64 | |
| 65 | #ifdef CONFIG_SIM_IMAGEPATH_AS_CWD |
| 66 | void host_init_cwd(void) |
| 67 | { |
| 68 | char *name; |
| 69 | char path[MAX_PATH]; |
| 70 | |
| 71 | /* Get the absolute path of the executable file */ |
| 72 | |
| 73 | if (GetModuleFileNameA(GetModuleHandleA(NULL), path, MAX_PATH) == 0) |
| 74 | { |
| 75 | perror("GetModuleFileNameA failed"); |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | name = strrchr(path, '/'); |
| 80 | if (name == NULL) |
| 81 | { |
| 82 | name = strrchr(path, '\\'); |
| 83 | } |
| 84 | |
| 85 | *++name = '\0'; |
| 86 | _chdir(path); |
| 87 | } |
| 88 | #endif |
no test coverage detected