| 857 | } |
| 858 | |
| 859 | bool MountSystem::createPath(const Path& path) |
| 860 | { |
| 861 | if (path.getPath().isEmpty()) |
| 862 | return true; |
| 863 | |
| 864 | // See if the pathectory exists |
| 865 | Path dir; |
| 866 | dir.setRoot(path.getRoot()); |
| 867 | dir.setPath(path.getPath()); |
| 868 | |
| 869 | // in a virtual mount system, isDirectory may return true if the directory exists in a read only FS, |
| 870 | // but the directory may not exist on a writeable filesystem that is also mounted. |
| 871 | // So get the target filesystem that will |
| 872 | // be used for the full writable path and and make sure the directory exists on it. |
| 873 | FileSystemRef fsRef = getFileSystem(path); |
| 874 | |
| 875 | if (isDirectory(dir,fsRef)) |
| 876 | return true; |
| 877 | |
| 878 | // Start from the top and work our way down |
| 879 | Path sub; |
| 880 | dir.setPath(path.isAbsolute()? String("/"): String()); |
| 881 | for (U32 i = 0; i < path.getDirectoryCount(); i++) |
| 882 | { |
| 883 | sub.setPath(path.getDirectory(i)); |
| 884 | dir.appendPath(sub); |
| 885 | if (!isDirectory(dir,fsRef)) |
| 886 | { |
| 887 | if (!createDirectory(dir,fsRef)) |
| 888 | return false; |
| 889 | } |
| 890 | } |
| 891 | return true; |
| 892 | } |
| 893 | |
| 894 | |
| 895 | //----------------------------------------------------------------------------- |
no test coverage detected