#include <mi32/filepath.h>
Definition at line 216 of file filepath.h.
| typedef ERRVALUE(*) FILEPATH::StatusCallback(INT64 FileSize, INT64 BytesLeft, void *udata) |
Definition at line 219 of file filepath.h.
| enum FILEPATH::CHILDTYPE |
File system types as can be determined.
Definition at line 232 of file filepath.h.
| enum FILEPATH::PATHTYPE |
Common file path types.
Definition at line 245 of file filepath.h.
| enum FILEPATH::PERMISSION |
Possible file permissions to set or check for.
| PERMISSION_Invalid | |
| PERMISSION_Exists | |
| PERMISSION_Read | |
| PERMISSION_Write | |
| PERMISSION_ReadWrite | |
| PERMISSION_Execute |
Definition at line 222 of file filepath.h.
| FILEPATH::FILEPATH | ( | ) |
Default constructor, empty path.
| FILEPATH::FILEPATH | ( | const FILEPATH & | p | ) |
Copy constructor.
Concatenation constructor, 'dir' must be a directory.
Concatenation constructor, 'dir' must be a directory.
| FILEPATH::FILEPATH | ( | const FILEPATH & | dir, | |
| const char * | name, | |||
| CHAR_ENCODING | encoding = CHAR_ENCODING_ASCII | |||
| ) |
Concatenation constructor, 'dir' must be a directory.
| FILEPATH::FILEPATH | ( | PATHTYPE | type | ) | [explicit] |
Constructor, inialize with a system path.
| FILEPATH::FILEPATH | ( | const MIUNICODE * | p | ) |
Constructor, initialize with MIUNICODE*, for compatibility.
| FILEPATH::FILEPATH | ( | const char * | p, | |
| CHAR_ENCODING | encoding = CHAR_ENCODING_ASCII | |||
| ) | [explicit] |
Constructor, initialize with C string, for efficiency.
| FILEPATH::FILEPATH | ( | void * | IniHandle, | |
| const char * | group, | |||
| const char * | field | |||
| ) |
Initialize a FILEPATH with an entry from an INI file.
| IniHandle | Handle to INI file to read from, 0 for default file "tntproc.ini" |
| group | INI group to read path from |
| field | INI field to read path from |
| FILEPATH::~FILEPATH | ( | ) |
Destructor.
| FILEPATH& FILEPATH::Append | ( | const char * | q, | |
| CHAR_ENCODING | encoding | |||
| ) |
Append a string to FILEPATH, adding separator.
| q | String to append with |
| encoding | Encoding of the string |
| FILEPATH& FILEPATH::Assign | ( | const char * | p, | |
| CHAR_ENCODING | encoding = CHAR_ENCODING_ASCII | |||
| ) |
Assign a character string representation of a path to FILEPATH using the character encoding.
| ERRVALUE FILEPATH::CheckAccess | ( | const PERMISSION | perm = PERMISSION_Read |
) | const |
Check access permissions on the file / directory.
| perm | Access permission to check for |
| void FILEPATH::Clear | ( | ) |
Clear the path representation.
| bool FILEPATH::Contains | ( | const FILEPATH & | SubPath | ) | const |
Check if path contains "subpath" given.
| SubPath | Subpath to check against |
Convert user displayable into a component OS filename Only has an effect on MAC_OSX where the slash '/' is transposed to a colon ':' from displaying.
Convert component OS filename passed in to a displayable filename.
Only has an effect on MAC_OSX where the colon ':' is transposed to a slash '/' when displaying
| ERRVALUE FILEPATH::CopyFileFrom | ( | const FILEPATH & | SourcePath, | |
| StatusCallback | StatusCB = 0, |
|||
| void * | udata = 0 | |||
| ) | const |
Copy contents from SourcePath.
| SourcePath | Source file to copy from |
| StatusCB | Callback to report file copy status |
| udata | Callback data passed to status callback |
| void FILEPATH::CopyFileFromDetached | ( | const FILEPATH & | SourcePath | ) | const |
Copy contents from SourcePath.
This method creates a MITHREAD_DETACHED derived class to copy the file, therefore this method is asynchronous and will return immediately.
| SourcePath | Source file to copy from |
| bool FILEPATH::Exists | ( | ) | const |
Check if file exists.
| char* FILEPATH::GenerateEncodedOSPath | ( | ) | const |
Generate Operating system specific path with the proper encoding for character based IO calls.
Use this method to call functions that take a path ONLY if nothing else can be done and it is a third party library. It is not known if the third party library can handle the multiple encodings if they manipulate the path.
Generate a temp file given a basepath and a basename for the temp file Called by FILEFIND::MakeTempFile().
| INT64 FILEPATH::GetAvailableSpace | ( | ) | const |
Returns the amount of free space on the volume that the path represents.
| int FILEPATH::GetChildren | ( | MISTRINGLIST & | ChildList, | |
| const MISTRING & | pattern, | |||
| CHILDTYPE | ChildType | |||
| ) | const |
Obtain a list of child directories or files that exist under this path using a pattern to select which children to find.
| ChildList | List of child names found after search |
| pattern | Pattern to match |
| ChildType | Type of children to search for CHILDTYPE_Directory or CHILDTYPE_File. |
| int FILEPATH::GetChildren | ( | MISTRINGLIST & | ChildList, | |
| CHILDTYPE | ChildType | |||
| ) | const |
Obtain a list of child directories or files that exist under this path.
| ChildList | List of child names found after search |
| ChildType | Type of children to search for CHILDTYPE_Directory or CHILDTYPE_File. |
| int FILEPATH::GetComponents | ( | MISTRINGLIST & | CompList | ) | const |
Separate path into individual components, returns number of components.
| CompList | List of components RETURNED |
| MISTRING FILEPATH::GetDisplay | ( | ) | const |
Get the display string representation for the path.
Used to get a string that is to be displayed to the end user.
| static int FILEPATH::GetDriveList | ( | MISTRINGLIST & | DriveList | ) | [static] |
Determine list of drives / volumes for this OS.
| MISTRING FILEPATH::GetEncoded | ( | ) | const |
Get the encoded string representation for the path.
Used to get a string that is to be saved to a database / file for later retrieval. The encoding is used in the case of file transfer to different system types, Eg UNIX -> WIN32 or MAC -> WIN32 or any other combination.
| static bool FILEPATH::GetEnvPath | ( | const char * | name, | |
| MISTRING & | EnvPathStr | |||
| ) | [static] |
Get an environment variable as a path (or paths) and convert using the correct OS encoding.
| MISTRING FILEPATH::GetExtension | ( | ) | const |
Get the file name extension, without the extension marker.
The extension is considered to be the string after the last extension marker. Eg. in "test.rvc.txt", 'txt' would be the extension returned.
| FILESYSTYPE FILEPATH::GetFileSysType | ( | ) | const |
Get type of system drive the path represents.
| UINT32 FILEPATH::GetFullPathSizeLimit | ( | ) | const |
Get maximum amount of characters allowed for an operating system's full path.
| DEPRECATED MISTRING FILEPATH::GetMioPath | ( | ) | const |
Get the Mio.
..() encoded string representation for the path. Used in legacy code where the function requires a const MIUNICODE* string.
| MISTRING FILEPATH::GetName | ( | ) | const |
Get the last component name (file or folder) with extension (if exists).
| MISTRING FILEPATH::GetNameOnly | ( | ) | const |
Get the file name only, no extension, unless directory.
A directory is not considered to have an extension, therefore if this path represents a directory, the name with extension is returned.
| UINT32 FILEPATH::GetNameSizeLimit | ( | ) | const |
Get maximum amount of characters allowed for an operating system's path segment.
| static const MISTRING& FILEPATH::GetNonValidComponentChars | ( | ) | [static] |
Get set of characters which are not valid for a path component.
This will include separators and filesystem specifiers.
| MISTRING FILEPATH::GetOSPath | ( | ) | const |
Get the OS string representation for the path.
Used to generate valid path string for use in OS-specific file I/O functions. Does not insert quotes around components containing spaces. Note, you probably really want GenerateEncodedOSPath() which will convert the filename to the character encoding of the file system
| FILEPATH FILEPATH::GetPathOnly | ( | ) | const |
Get the path representation only.
| PERMISSION FILEPATH::GetPermission | ( | ) | const |
Get access permissions on the file / directory.
| MISTRING FILEPATH::GetQuotedPath | ( | ) | const |
Get path with quotes inserted around components containing spaces.
Used to generate a valid string to use command lines.
Generate an encoded relative path from a system default path.
Generate an encoded relative path from a source path.
The string returned will be one of three types: 1. A string == ".", the current path and the source path are equal 2. An encoded string from GetEncoded() method, the two paths are completely unrelated 3. An encoded string with the relative path.
See also IsRelativePath().
| BasePath | Base path which the instance is compared to and the relative path is generated against |
| INT64 FILEPATH::GetSize | ( | ) | const |
Return size of the file.
| INT64 FILEPATH::GetSystemMaxSize | ( | ) | const |
Return maximum size of a file on the drive represented.
| ERRVALUE FILEPATH::GetTimeCreated | ( | time_t * | rettime | ) | const |
Get the creation time for the file.
| rettime | UTC time |
| ERRVALUE FILEPATH::GetTimeModified | ( | time_t * | rettime | ) | const |
Get the modification time for the file.
| rettime | UTC time |
| bool FILEPATH::HasChildren | ( | CHILDTYPE | ChildType | ) | const |
Does the path have children of a specific type?
| ChildType | Type of children to search for CHILDTYPE_Directory or CHILDTYPE_File. |
| bool FILEPATH::HasExtension | ( | ) | const |
Does the Name part of the path have an extension?
| bool FILEPATH::IniRead | ( | void * | IniHandle, | |
| const char * | group, | |||
| const char * | field | |||
| ) |
Initialize a FILEPATH with an entry from an INI file.
| IniHandle | Handle to INI file to read from, 0 for default file "tntproc.ini" |
| group | INI group to read path from |
| field | INI field to read path from |
| void FILEPATH::IniWrite | ( | void * | IniHandle, | |
| const char * | group, | |||
| const char * | field | |||
| ) | const |
Write encoded filepath to .ini file.
| IniHandle | Handle to INI file to write to, 0 for default file "tntproc.ini" |
| group | INI group to write encoded path to |
| field | INI field to write encoded path to |
| bool FILEPATH::IsChildPath | ( | const FILEPATH & | BasePath | ) | const |
Is the path a child path of 'BasePath'.
| bool FILEPATH::IsEmpty | ( | ) | const |
Is FILEPATH empty?
| bool FILEPATH::IsEqual | ( | const FILEPATH & | TestPath | ) | const |
Are the paths equal?
Case insensitive check for WIN32, MAC.
| bool FILEPATH::IsFile | ( | ) | const |
Is FILEPATH an existing file?
| bool FILEPATH::IsFolder | ( | ) | const |
Is FILEPATH an existing folder (directory)?
| bool FILEPATH::IsLessThan | ( | const FILEPATH & | TestPath | ) | const |
Is "this" less than testpath?
Case insensitive check for WIN32, MAC.
| bool FILEPATH::IsPathOnly | ( | ) | const |
Is the file referenced a directory?
A non-existant path is a directory.
| bool FILEPATH::IsReadable | ( | ) | const |
Is the path / file readable?
| static bool FILEPATH::IsRelativePath | ( | const MIUNICODE * | path | ) | [static] |
Is the string given specify a relative path.
A string is considered a relative path if: 1. The string is empty or the string == "." 2. The string starts with a relative path indicator specific for the platform On all but the MAC, the string can start with either the same directory relative path or the parent directory relative path. The MAC does not have a current directory relative path.
Example: if (FILEPATH::IsRelativePath(RelStr)) { FilePath = BasePath; // Assign base path to dest FilePath += RelStr; // Concatinate relative path onto dest } else { FilePath = RelStr; // Full path, assign to dest }
| path | String to determine if a relative path |
| bool FILEPATH::IsRootOnly | ( | ) | const |
Is the path a root path?
| bool FILEPATH::IsSameExtn | ( | const MISTRING & | extn | ) | const |
Does the filepath have the same extension as that passed in This method is used to speed up extension checking without creating one or two MISTRINGs This method uses no-case comparisons.
| extn | Do not prepend extension marker '.' |
| bool FILEPATH::IsSameExtn | ( | const char * | extn | ) | const |
Does the filepath have the same extension as that passed in This method is used to speed up extension checking without creating one or two MISTRINGs This method uses no-case comparisons.
| extn | Do not prepend extension marker '.' |
| bool FILEPATH::IsUNCHostOnly | ( | ) | const |
Is the path a UNC host path only? (\\Machine).
| bool FILEPATH::IsUNCRoot | ( | ) | const |
Is the path a UNC root path? (\\Machine\share).
| static bool FILEPATH::IsValidName | ( | const MISTRING & | name | ) | [static] |
Determine if the path component is valid for the current OS.
| bool FILEPATH::IsWritable | ( | ) | const |
Is the path / file writable?
(Writable is correct spelling).
| ERRVALUE FILEPATH::Make | ( | bool | MakeTree = false |
) | const |
Creates a path.
If 'MakeTree' true, will create all non-existant directories listed in its path.
Creates a hard link to the file 'SrcFile', given the new filename 'this'.
| static bool FILEPATH::MakeValidChars | ( | MISTRING & | name | ) | [static] |
Validate characters in path component for the current OS.
Does not check for reserved names.
| static bool FILEPATH::MakeValidName | ( | MISTRING & | name | ) | [static] |
Validate the path component for the current OS.
| FILEPATH& FILEPATH::operator+= | ( | const char * | q | ) |
Concatenate from C string, for efficiency.
| q | ASCII encoded string |
Concatenate from MIUNICODE*, adding separator.