| 692 | } |
| 693 | |
| 694 | void Utility::MkDirP(const String& path, int mode) |
| 695 | { |
| 696 | size_t pos = 0; |
| 697 | |
| 698 | while (pos != String::NPos) { |
| 699 | #ifndef _WIN32 |
| 700 | pos = path.Find("/", pos + 1); |
| 701 | #else /*_ WIN32 */ |
| 702 | pos = path.FindFirstOf("/\\", pos + 1); |
| 703 | #endif /* _WIN32 */ |
| 704 | |
| 705 | String spath = path.SubStr(0, pos + 1); |
| 706 | struct stat statbuf; |
| 707 | if (stat(spath.CStr(), &statbuf) < 0 && errno == ENOENT) |
| 708 | MkDir(path.SubStr(0, pos), mode); |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | void Utility::Remove(const String& path) |
| 713 | { |