File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,31 @@ inline void _splitpath (
105105 strcpy (drive, " " );
106106
107107 if (dir) {
108- strcpy (dir, dirname (tmp));
108+ char tmp_dir[PATH_MAX] = {0 };
109+ strcpy (tmp_dir, tmp); // W/A for fname broking
110+ strcpy (dir, dirname (tmp_dir)); // This eval modify dirname argument!!!
109111 if (dir[0 ] && dir[strlen (dir) - 1 ] != ' /' )
110112 strcat (dir, " /" );
111113 }
112114
113115 if (fname)
116+ {
114117 strcpy (fname, basename (tmp));
118+ char *pos = strrchr (fname, ' .' );
119+ if (pos != NULL )
120+ *pos = 0 ;
121+ }
122+
123+ if (ext)
124+ {
125+ char tmp_ext[NAME_MAX] = { 0 };
126+ strcpy (tmp_ext, basename (tmp));
127+ char *pos = strrchr (fname, ' .' );
128+ if (pos != NULL )
129+ strcpy (ext, pos + 1 );
130+ else
131+ strcpy (ext, " " );
132+ }
115133}
116134
117135#include < iostream>
You can’t perform that action at this time.
0 commit comments