int PluginClass::SetDirectory(const char *Dir,int OpMode) { if (*Dir=='\\' && *(++Dir)==0) { *CurDir=0; return TRUE; } if (lstrcmp(Dir,"..")==0) { if (*CurDir==0) return FALSE; char *Slash=strrchr(CurDir,'\\'); if (Slash!=NULL) *Slash=0; else *CurDir=0; } else { int Found=FALSE; int CurDirLength=lstrlen(CurDir); if (CurDirLength!=0) CurDirLength++; int NewDirLength=lstrlen(Dir); for (int I=0;I<ArcDataCount;I++) { char *CurName=ArcData[I].FindData.cFileName; if (lstrlen(CurName)>=CurDirLength+NewDirLength && LocalStrnicmp(CurName+CurDirLength,Dir,NewDirLength)==0) { char Ch=CurName[CurDirLength+NewDirLength]; if (Ch=='\\' || Ch=='/' || Ch==0) { Found=TRUE; break; } } } if (!Found) return FALSE; if (*CurDir==0 || *Dir==0 || strchr(Dir,'\\')!=0) lstrcpy(CurDir,Dir); else { FSF.AddEndSlash(CurDir); lstrcat(CurDir,Dir); } } return TRUE; }
int WINAPI LStrnicmp(const char *s1,const char *s2,int n) { return LocalStrnicmp(s1,s2,n); }