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
...@@ -119,24 +119,19 @@ void DLLCALL _splitpath(const char *path, char *drive, char *dir, char *fname, c ...@@ -119,24 +119,19 @@ void DLLCALL _splitpath(const char *path, char *drive, char *dir, char *fname, c
char* p; char* p;
ext[0]=0; ext[0]=0;
drive[0]=0; /* no drive letters on Unix */ drive[0]=0; /* no drive letters on Unix */
strcpy(dir,path); strcpy(dir,path); /* Optional directory path, including trailing slash. */
p=strrchr(dir,'/'); p=getfname(dir);
if(p==NULL) strcpy(fname,p); /* Base filename (no extension) */
p=strrchr(dir,'\\'); if(p==dir)
if(p==NULL) { dir[0]=0; /* no directory specified in path */
p=(char*)path; else
dir[0]=0; *p=0; /* truncate dir at filename */
} else { p=getfext(fname);
*p=0; /* truncate dir */
p++;
}
strcpy(fname,p);
p=strrchr(fname,'.');
if(p!=NULL) { if(p!=NULL) {
strcpy(ext,p); /* Optional filename extension, including leading period (.) */
*p=0; *p=0;
strcpy(ext,p+1);
} }
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment