#include <opennurbs_file_utilities.h>
Public Types | |
enum | PathId : unsigned int { PathId::Unset = 0, PathId::DesktopDirectory = 1, PathId::DocumentsDirectory = 2, PathId::DownloadsDirectory = 3 } |
ids used by ON_FileSystemPath::GetPath() More... | |
Static Public Member Functions | |
static const ON_wString | CleanPath (bool bTrimLeft, bool bTrimRight, bool bAllowWindowsUNCHostNameOrDiskLetter, bool bDeleteWindowsUNCHostNameOrDiskLetter, const wchar_t directory_separator, const wchar_t *dirty_path) |
Condenses // to / Condenses /./ to / Condenses /sfsdf/../ to / Sets all directory separators to directory_separator. More... | |
static const ON_wString | CleanPath (const wchar_t *dirty_path) |
Condenses // to / Condenses /./ to / Condenses /sfsdf/../ to / Trims left and right white space. Sets all directory separators to ON_FileSystemPath::DirectorySeparator. If the Platform is not windows, the UNC host names and volume letters are deleted. More... | |
static const ON_wString | CombinePaths (const wchar_t *left_side, bool bLeftSideContainsFileName, const wchar_t *right_side, bool bRightSideContainsFileName, bool bAppendTrailingDirectorySeparator) |
Combine paths into a single valid path name. Remove internal .. and . directory references. If necessary remove file names. More... | |
static const ON_wString | CurrentDirectory (bool bWithTrailingDirectorySeparator) |
static const ON_wString | DirectoryFromPath (const wchar_t *path) |
static const ON_wString | FileNameExtensionFromPath (const wchar_t *path) |
static const ON_wString | FileNameFromPath (const wchar_t *path, bool bIncludeExtension) |
static bool | FilePathHas3dmExtension (const wchar_t *file_path, bool bAllow3dmbakExtension) |
static bool | FilePathHas3dmExtension (const char *file_path, bool bAllow3dmbakExtension) |
static const ON_wString | FullPathFromRelativePath (const wchar_t *base_path, bool bBasePathIncludesFileName, const wchar_t *relative_path) |
static bool | IsDirectory (const char *path) |
static bool | IsDirectory (const wchar_t *path) |
static bool | IsDirectorySeparator (char c, bool bAllowAlternate) |
static bool | IsDirectorySeparator (wchar_t c, bool bAllowAlternate) |
static bool | IsFile (const char *path) |
static bool | IsFile (const wchar_t *path) |
static bool | IsRelativePath (const wchar_t *path, const wchar_t directory_separator) |
static bool | IsRelativePath (const wchar_t *path) |
static bool | IsValidFileName (const char *file_name, bool bAllPlatforms) |
Determine if the file_name string is a permitted file name. Valid file names must be non empty, cannot have two periods in a row, and cannot contain directory separators, tildes, and other platform specific values. More... | |
static bool | IsValidFileName (const wchar_t *file_name, bool bAllPlatforms) |
Determine if the file_name string is a permitted file name. Valid file names must be non empty, cannot have two periods in a row, and cannot contain directory separators, tildes, and other platform specific values. More... | |
static bool | PathExists (const char *path) |
static bool | PathExists (const wchar_t *path) |
static const ON_wString | PlatformPath (ON_FileSystemPath::PathId path_id) |
static bool | PlatformPathIgnoreCase () |
static const ON_wString | RelativePath (const wchar_t *full_path, bool bFullPathIncludesFileName, const wchar_t *base_path, bool bBasePathIncludesFileName) |
Get a the relative path from base_path to full_path. More... | |
static const ON_wString | RemoveFileName (const wchar_t *path, ON_wString *file_name) |
Removes file name from path. More... | |
static const ON_wString | RemoveVolumeName (const wchar_t *path, ON_wString *volume_name) |
Removes Windows volume name from path. More... | |
static void | SplitPath (const char *path, ON_String *volume, ON_String *dir, ON_String *file_name_stem, ON_String *file_name_ext) |
Find the locations in a path the specify the drive, directory, file name and file extension. More... | |
static void | SplitPath (const char *path, ON_wString *volume, ON_wString *dir, ON_wString *file_name_stem, ON_wString *file_name_ext) |
static void | SplitPath (const wchar_t *path, ON_wString *volume, ON_wString *dir, ON_wString *file_name_stem, ON_wString *file_name_ext) |
static void | SplitPath (const wchar_t *path, ON_wString *volume, ON_wString *dir, ON_wString *file_name_stem_and_extension) |
static const ON_wString | VolumeAndDirectoryFromPath (const wchar_t *path) |
static const ON_wString | VolumeFromPath (const wchar_t *path) |
Static Public Attributes | |
static const wchar_t | AlternateDirectorySeparator |
static const char | AlternateDirectorySeparatorAsChar |
static const wchar_t | DirectorySeparator |
static const char | DirectorySeparatorAsChar |
|
strong |
|
static |
Condenses // to / Condenses /./ to / Condenses /sfsdf/../ to / Sets all directory separators to directory_separator.
bAllowWindowsUNCHostNameOrDiskLetter | [in] If bAllowWindowsUNCHostNameOrDiskLetter and the path begins with \HostName followed by a directory separator, then the initial \ is not condensed. If the path begins with X: followed by a directory separator, where "X" is a single letter in the range A to Z or a to z, then the path is considered valid. |
bDeleteWindowsUNCHostNameOrDiskLetter | [in] If bAllowWindowsUNCHostNameOrDiskLetter is true and the path begins with a UNC host name or disk letter followed by a directory separator, then host name or disk letter is deleted. This is useful when using paths from a Windows platform on a |
non | Windows platform. |
directory_separator | [in] If 0 == directory_separator, then the first directory separator is kept when condensing occurs. ON_wString::FileSystemPathSeparator is a good choice if you want to use the current runtime's separator. |
dirty_path | [in] path to clean. Return: Cleaned path. |
|
static |
Condenses // to / Condenses /./ to / Condenses /sfsdf/../ to / Trims left and right white space. Sets all directory separators to ON_FileSystemPath::DirectorySeparator. If the Platform is not windows, the UNC host names and volume letters are deleted.
|
static |
Combine paths into a single valid path name. Remove internal .. and . directory references. If necessary remove file names.
left_side | [in] |
bLeftSideContainsFileName | [in] true if left_side path ends in a file name and that file name is removed and discarded. |
right_side | [in] |
bRightSideContainsFileName | [in] true if right_side path ends in a file name. If bAppendTrailingDirectorySeparator is true, that file name is removed and discarded. If bAppendTrailingDirectorySeparator is false, the returned path ends in that file name. |
bAppendTrailingDirectorySeparator | [in] If true, any file names are removed and a directory separator is appended to the returned string. |
This function manipulates string information. This function does not look at storage media to see if the paths currently exist.
|
static |
bWithTrailingDirectorySeparator | [in] |
true | returned path will have a trailing directory separator. |
false | returned path will not have a trailing directory separator. |
|
static |
path | [in] path to split |
|
static |
path | [in] path to split |
|
static |
path | [in] path to split |
bIncludeExtension | [in] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
path | [in] path to test |
directory_separator | [in] If 0 == directory_separator, then either ON_wString::FileSystemPathSeparator or ON_wString::AlternateFileSystemPathSeparator is permitted as a directory separator. ON_wString::FileSystemPathSeparator is a good choice if you want to use the current runtime's separator. |
|
static |
path | [in] path to test |
|
static |
Determine if the file_name string is a permitted file name. Valid file names must be non empty, cannot have two periods in a row, and cannot contain directory separators, tildes, and other platform specific values.
file_name | [in] string to test. |
bAllPlatforms | [in] If true, test name for all supported platforms. |
|
static |
Determine if the file_name string is a permitted file name. Valid file names must be non empty, cannot have two periods in a row, and cannot contain directory separators, tildes, and other platform specific values.
file_name | [in] string to test. |
bAllPlatforms | [in] If true, test name for all supported platforms. |
|
static |
|
static |
|
static |
path_id | [in] Specifies path to get. |
|
static |
Windows and default installations of OS X 10.10.3, and default installations of the UNIX terminal interface in OS X 10.10.3 and later ignore case. In the case of OX X, a user can override the default setting.
|
static |
Get a the relative path from base_path to full_path.
full_path | [in] |
base_path | [in] |
Example full_path = L"c:/a/b/c/d/somefile.txt"; base_path = L"C:/A/B/X/Y/Z/model.3dm"; ON_wString::GetRelativePath(full_path,base_path) returns L"../../../c/d/somefile.txt"
Example full_path = L"c:/a/b/somefile.txt"; base_path = L"C:/A/B/model.3dm"; ON_wString::GetRelativePath(full_path,base_path) returns L"./somefile.txt"
Path separators on the input can be mixed. Path separators on the returned relative path are ON_wString::FileSystemPathSeparator
|
static |
Removes file name from path.
path | [in] file system path with a file name. |
file_name | [out] If file_name is not nullptr, the removed portion of path is returned here. |
This function uses on_wsplitpath() to decide if the path ends with characters that could be a file name. It does not inspect the file system to see if the file exists.
|
static |
Removes Windows volume name from path.
path | [in] file system path |
volume_name | [out] If volume_name is not nullptr, the removed portion of path is returned here. |
This function uses on_wsplitpath() to decide if the path begins with characters that could be a volume name. It does not inspect the file system to see if the volume exists.
|
static |
Find the locations in a path the specify the drive, directory, file name and file extension.
path | [in] path to split |
volume | [out] (pass null if you don't need the volume) If volume is not null and the path parameter begins with a Windows volume specification, *volume will either be the Windows volume letter followed by the trailing colon or a Windows UNC \<hostname>. Otherwise volume will be the empty string. |
dir | [out] (pass null if you don't need the directory) If dir is not null and the path parameter contains a directory specification, then the returned value of *dir will be the directory specification including the trailing slash. |
file_name_stem | [out] (pass null if you don't need the file name stem) If file_name_stem is not null and the path parameter contains a file name specification, then the returned value of *file_name_stem will be the file name stem. |
file_name_ext | [out] (pass null if you don't need the extension) If file_name_ext is not null and the path parameter contains a file name extension specification, then the returned value of *file_name_ext will be the file name extension including the initial '.' character. |
This function will treat a front slash ( / ) and a back slash ( \ ) as directory separators. Because this function parses file names store in .3dm files and the .3dm file may have been written on a Windows computer and then read on a another computer, it looks for a volume specification even when the operating system is not Windows. This function will not return an directory that does not end with a trailing slash. This function will not return an empty filename and a non-empty extension. This function parses the path string according to these rules. It does not check the actual file system to see if the answer is correct.
|
static |
|
static |
|
static |
|
static |
path | [in] path to split |
|
static |
path | [in] path to split |
|
static |
|
static |
|
static |
|
static |