MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / createPath

Method createPath

Engine/source/core/volume.cpp:859–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

857}
858
859bool 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//-----------------------------------------------------------------------------

Callers 1

CreatePathFunction · 0.45

Calls 10

isAbsoluteMethod · 0.80
getDirectoryCountMethod · 0.80
getDirectoryMethod · 0.80
appendPathMethod · 0.80
StringClass · 0.50
isEmptyMethod · 0.45
getPathMethod · 0.45
setRootMethod · 0.45
getRootMethod · 0.45
setPathMethod · 0.45

Tested by

no test coverage detected