The following function can be used to parse file name paths and extract different parts like the path, the file name, the type (extension) etc.
sysInfo.currentdir()
to get the current working directory.filenameFromPath <filename_string>
Returns the file name and extension of a full file name, useful for labeling file buttons in rollout panels.
getFilenamePath <filename_string>
Returns the directory path part of a full file name.
getFilenameFile <filename_string>
Returns the file name part of a full file name.
getFilenameType <filename_string>
Returns the type extension part of a full file name.
doesFileExist <filename_string> allowDirectory:<boolean> ignoreCache:<boolean>
Returns true if the file exists, false otherwise.
When allowDirectory is true (the default), the <filename_string>
can be a directory name.
if ignoreCache
is specified as true, testing does not consider whether the file's path may be in the File Path Not Present Cache maintained by the MissingPathCache. See missingPathCache Interface for more information.
doesDirectoryExist <directoryname_string>
Returns true if the directory exists, false otherwise.
pathIsNetworkPath <file_path>
[ AVG ] Returns true if the specified file path has a UNC network path signature (\\device0\) and false if it has a local path signature (D:\) where D: is a drive letter.
Available since 3ds Max 2008.
The method does not test for the path's existence, it only checks the signature of the path to see if it is UNC or local.
See also pathConfig.isUncPath()
in the PathConfig Struct topic.
EXAMPLES:
file="g:\\subdir1\\subdir2\\myImage.jpg" filenameFromPath file -- returns: "myImage.jpg" getFilenamePath file -- returns: "g:\subdir1\subdir2\" getFilenameFile file -- returns: "myImage" getFilenameType file -- returns: ".jpg" pathIsNetworkPath "c:\\temp\\test.txt" --returns: false pathIsNetworkPath "\\\\someserver\\temp\\test.txt" --returns: true