diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c index eb213001d554c8c2d5ce1dbb432aa83dc783cf02..353bdd658abd358ed7fa2b800be0d0a572ebf6ee 100644 --- a/src/xpdev/dirwrap.c +++ b/src/xpdev/dirwrap.c @@ -573,6 +573,33 @@ BOOL DLLCALL fexistcase(char *path) #endif } +#ifndef _WIN32 +int removecase(char *path) +{ + char inpath[MAX_PATH+1]; + char fname[MAX_PATH*4+1]; + char tmp[5]; + char *p; + int i; + + SAFECOPY(inpath,path); + p=getfname(inpath); + SAFECOPY(fname,p); + *p=0; + fname[0]=0; + p++; + for(;*p;p++) { + if(isalpha(*p)) + sprintf(tmp,"[%c%c]",toupper(*p),tolower(*p)); + else + sprintf(tmp,"%c",*p); + strncat(fname,tmp,MAX_PATH*4); + } + + return(delfiles(inpath,fname)?-1:0); +} +#endif + #if !defined(S_ISDIR) #define S_ISDIR(x) ((x)&S_IFDIR) #endif @@ -644,7 +671,7 @@ ulong DLLCALL delfiles(char *inpath, char *spec) glob_t g; lastch=*lastchar(inpath); - if(!IS_PATH_DELIM(lastch)) + if(!IS_PATH_DELIM(lastch) && lastch) sprintf(path,"%s%c",inpath,PATH_DELIM); else strcpy(path,inpath); diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h index cf9f52c6b618e2051c384ffe7b04f3fabc0f0fce..dd7664fcd9d9beb9e3e2016b799232ba6c104024 100644 --- a/src/xpdev/dirwrap.h +++ b/src/xpdev/dirwrap.h @@ -240,6 +240,9 @@ DLLEXPORT int DLLCALL mkdirs(const char* path); DLLEXPORT void DLLCALL _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext); DLLEXPORT char * DLLCALL _fullpath(char *target, const char *path, size_t size); +DLLEXPORT int DLLCALL removecase(char *path); +#else + #define removecase(x) remove(x) #endif #if defined(__cplusplus)