| 3944 | } |
| 3945 | |
| 3946 | void 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 | |