| 94 | } |
| 95 | |
| 96 | bool change_directory(const char *dir) |
| 97 | { |
| 98 | // if they only typed "cd" |
| 99 | if (dir == NULL) |
| 100 | { |
| 101 | // if (SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, path) == S_OK) |
| 102 | // ^ x86_64-w64-mingw32-gcc doesn't like shlobj.h |
| 103 | char path[MAX_PATH]; |
| 104 | if (GetEnvironmentVariableA("USERPROFILE", path, MAX_PATH) > 0) |
| 105 | { |
| 106 | if (SetCurrentDirectoryA(path)) |
| 107 | { |
| 108 | return true; |
| 109 | } |
| 110 | } |
| 111 | return false; |
| 112 | } |
| 113 | |
| 114 | // Change directory - works with relative and absolute |
| 115 | if (SetCurrentDirectoryA(dir)) |
| 116 | { |
| 117 | return true; |
| 118 | } |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | #else |
| 123 | void send_cwd(SSL *ssl) |