diff options
| author | ivn <[email protected]> | 2020-05-14 18:30:32 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-14 17:30:32 +0200 |
| commit | 730375faf738790b32e31f668813443ecdfd8150 (patch) | |
| tree | d4ca5bd2c57861858861460be9bb4e114a865059 /src | |
| parent | 257f232d418cd0e8dc6aef409a16defca044fa1a (diff) | |
| download | raylib-730375faf738790b32e31f668813443ecdfd8150.tar.gz raylib-730375faf738790b32e31f668813443ecdfd8150.zip | |
fix bug in GetPrevDirectoryPath on Unix-like systems (#1246)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2087,11 +2087,12 @@ const char *GetPrevDirectoryPath(const char *dirPath) if (pathLen <= 3) strcpy(prevDirPath, dirPath); - for (int i = (pathLen - 1); (i > 0) && (pathLen > 3); i--) + for (int i = (pathLen - 1); (i >= 0) && (pathLen > 3); i--) { if ((dirPath[i] == '\\') || (dirPath[i] == '/')) { - if (i == 2) i++; // Check for root: "C:\" + if ((i == 2) && (dirPath[1] ==':') // Check for root: "C:\" + || i == 0) i++; // Check for root: "/" strncpy(prevDirPath, dirPath, i); break; } |
