Skip to content

Commit

Permalink
Merge pull request #468 from fjtrujy/fix_relative_paths
Browse files Browse the repository at this point in the history
Fix relative paths
  • Loading branch information
uyjulian authored Dec 4, 2023
2 parents 1640135 + e476644 commit 96a0bae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ee/libcglue/src/cwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int __get_drive(const char *d)
int i;
for(i=0; d[i]; i++) {
if(! ((d[i] >= 'a' && d[i] <= 'z') ||
(d[i] >= 'A' && d[i] <= 'Z') ||
(d[i] >= '0' && d[i] <= '9') ))
break;
}
Expand Down Expand Up @@ -146,6 +147,11 @@ int __path_absolute(const char *in, char *out, int len)
/* It starts with "drive:/", so it's already absolute */
if(!__safe_strcpy(out, in, len))
return -1;
} else if(dr > 0 && in[dr - 1] == ':') {
/* It starts with "drive:", so it's already absoulte, however it misses the "/" after unit */
strncpy(out, in, dr);
out[dr] = '/';
strncpy(out + dr + 1, in + dr, len - dr - 1);
} else if(in[0] == '/') {
/* It's absolute, but missing the drive, so use cwd's drive */
if(strlen(__cwd) >= len)
Expand Down

0 comments on commit 96a0bae

Please sign in to comment.