diff options
author | Roel Spruit <roel@spruitje.nl> | 2003-12-01 17:27:06 +0300 |
---|---|---|
committer | Roel Spruit <roel@spruitje.nl> | 2003-12-01 17:27:06 +0300 |
commit | b5e0a7b401c47fb6b5a63a13792aab4b74efa3a2 (patch) | |
tree | 9fdddc5b50b31f3cbb2c93c7a87545e909a9e60f /source/blender/blenlib/intern/util.c | |
parent | e35ed554378396867b562fb47416e49b8c1eea28 (diff) |
Nathan Letwory's patch for Bug #458 (Fileselect bug)
Diffstat (limited to 'source/blender/blenlib/intern/util.c')
-rw-r--r-- | source/blender/blenlib/intern/util.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index a90cf21aa6c..4bf44e8df6a 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -676,24 +676,30 @@ void BLI_split_dirfile(char *string, char *dir, char *file) if (string[0] == '/' || string[0] == '\\') { strcpy(dir, string); } else if (string[1] == ':' && string[2] == '\\') { - strcpy(dir, string); - } else { - BLI_getwdN(dir); - strcat(dir,"/"); - strcat(dir,string); - strcpy(string,dir); - } - - BLI_make_exist(dir); - - if (S_ISDIR(BLI_exist(dir))) { - strcpy(file,string + strlen(dir)); - - if (strrchr(file,'\\')) strcpy(file,strrchr(file,'\\')+1); - - if (a = strlen(dir)) { - if (dir[a-1] != '\\') strcat(dir,"\\"); - } + strcpy(dir, string); + } else { + BLI_getwdN(dir); + strcat(dir,"/"); + strcat(dir,string); + strcpy(string,dir); + } + + BLI_make_exist(dir); + + // BLI_exist doesn't recognize a slashed dirname as a dir + // check if a trailing slash exists, and remove it. Do not do this + // when we are already at root. -jesterKing + a = strlen(dir); + if(a>=4 && dir[a-1]=='\\') dir[a-1] = 0; + + if (S_ISDIR(BLI_exist(dir))) { + strcpy(file,string + strlen(dir)); + + if (strrchr(file,'\\')) strcpy(file,strrchr(file,'\\')+1); + + if (a = strlen(dir)) { + if (dir[a-1] != '\\') strcat(dir,"\\"); + } } else { a = strlen(dir) - 1; |