MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / EnsureDirectory

Function EnsureDirectory

src/Setup/unzip.cpp:3946–3960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3944}
3945
3946void EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir)
3947{ if (rootdir!=0 && GetFileAttributes(rootdir)==0xFFFFFFFF) CreateDirectory(rootdir,0);
3948 if (*dir==0) return;
3949 const TCHAR *lastslash=dir, *c=lastslash;
3950 while (*c!=0) {if (*c=='/' || *c=='\\') lastslash=c; c++;}
3951 const TCHAR *name=lastslash;
3952 if (lastslash!=dir)
3953 { TCHAR tmp[MAX_PATH]; memcpy(tmp,dir,sizeof(TCHAR)*(lastslash-dir));
3954 tmp[lastslash-dir]=0;
3955 EnsureDirectory(rootdir,tmp);
3956 name++;
3957 }
3958 TCHAR cd[MAX_PATH]; *cd=0; if (rootdir!=0) _tcscpy_s(cd, MAX_PATH, rootdir); _tcscat_s(cd,dir);
3959 if (GetFileAttributes(cd)==0xFFFFFFFF) CreateDirectory(cd,NULL);
3960}
3961
3962
3963

Callers 1

UnzipMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected