| 1006 | } |
| 1007 | |
| 1008 | bool MountSystem::createPath(const Path& path) |
| 1009 | { |
| 1010 | if (path.getPath().isEmpty()) |
| 1011 | return true; |
| 1012 | |
| 1013 | // See if the pathectory exists |
| 1014 | Path dir; |
| 1015 | dir.setRoot(path.getRoot()); |
| 1016 | dir.setPath(path.getPath()); |
| 1017 | |
| 1018 | // in a virtual mount system, isDirectory may return true if the directory exists in a read only FS, |
| 1019 | // but the directory may not exist on a writeable filesystem that is also mounted. |
| 1020 | // So get the target filesystem that will |
| 1021 | // be used for the full writable path and and make sure the directory exists on it. |
| 1022 | FileSystemRef fsRef = getFileSystem(path); |
| 1023 | |
| 1024 | if (isDirectory(dir,fsRef)) |
| 1025 | return true; |
| 1026 | |
| 1027 | // Start from the top and work our way down |
| 1028 | Path sub; |
| 1029 | dir.setPath(path.isAbsolute()? String("/"): String()); |
| 1030 | for (U32 i = 0; i < path.getDirectoryCount(); i++) |
| 1031 | { |
| 1032 | sub.setPath(path.getDirectory(i)); |
| 1033 | dir.appendPath(sub); |
| 1034 | if (!isDirectory(dir,fsRef)) |
| 1035 | { |
| 1036 | if (!createDirectory(dir,fsRef)) |
| 1037 | return false; |
| 1038 | } |
| 1039 | } |
| 1040 | return true; |
| 1041 | } |
| 1042 | |
| 1043 | |
| 1044 | //----------------------------------------------------------------------------- |
no test coverage detected