version 1.37, 2006/01/30 16:17:08
|
version 1.38, 2006/06/07 21:38:15
|
|
|
char *System::extract_file_path(const char *fullpath, char *dirname) | char *System::extract_file_path(const char *fullpath, char *dirname) |
{ | { |
char *p; | char *p; |
char buff[2048]; |
char buff[4096]; |
if (fullpath == NULL) | if (fullpath == NULL) |
{ | { |
dirname[0] = '\0'; | dirname[0] = '\0'; |
return dirname; | return dirname; |
} | } |
strcpy(buff, fullpath); |
strncpy(buff, fullpath, sizeof(buff)-1); |
|
buff[sizeof(buff)-1] = '\0'; |
for(p = buff + strlen(buff); p >= buff; p--) | for(p = buff + strlen(buff); p >= buff; p--) |
{ | { |
if (*p == '\\' || *p == '/') | if (*p == '\\' || *p == '/') |