Skip to content
Snippets Groups Projects
Commit 567c2ddf authored by rswindell's avatar rswindell
Browse files

Fixed Unix _splitpath() to more closely mimic Win32 behavior: trailing slashes

included in directory and '.' included in extensions.
parent 9a956926
No related branches found
No related tags found
No related merge requests found
......@@ -121,22 +121,17 @@ void DLLCALL _splitpath(const char *path, char *drive, char *dir, char *fname, c
ext[0]=0;
drive[0]=0; /* no drive letters on Unix */
strcpy(dir,path);
p=strrchr(dir,'/');
if(p==NULL)
p=strrchr(dir,'\\');
if(p==NULL) {
p=(char*)path;
dir[0]=0;
} else {
*p=0; /* truncate dir */
p++;
}
strcpy(fname,p);
p=strrchr(fname,'.');
strcpy(dir,path); /* Optional directory path, including trailing slash. */
p=getfname(dir);
strcpy(fname,p); /* Base filename (no extension) */
if(p==dir)
dir[0]=0; /* no directory specified in path */
else
*p=0; /* truncate dir at filename */
p=getfext(fname);
if(p!=NULL) {
strcpy(ext,p); /* Optional filename extension, including leading period (.) */
*p=0;
strcpy(ext,p+1);
}
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment