#include <IFileUtility.h>
Utility interface that provides methods used to manipulate IDFiles and paths.
When possible, it is preferred to manipulate IDFile objects directly rather than using the IFileUtility methods.
- See Also
- IDFile
Identifiers that denote the type of file access desired. \ You cannot obtain access to a file with an access mode that conflicts with a sharing mode specified in a previous open request (from any process) whose handle is still open.
| Enumerator |
|---|
| kRead | Read access; open the file for reading only. |
| kWrite | Write access; open the file for writing only. |
| kReadWrite | Read and write access; open the file for reading and writing. |
Makes a path to a temporary file in the system's temporary file directory using the current file name. \ This call does not create the temporary file.
- Returns
- kTrue if success, else kFalse.
| virtual IFileUtility::~IFileUtility | ( | | ) | |
| inlinevirtual |
Tests whether the file or directory can be opened with the specified access. \ The state of whether a file can be opened may change at any time, so it is best to attempt to open the file immediately following the call to CanOpen().
- Parameters
| access | IN Type of file access desired. |
- Returns
- kTrue if the file or directory can be opened with the given access, else kFalse.
| virtual bool16 IFileUtility::CopyFile | ( | const IDFile & | destSpec | ) | |
| pure virtual |
Copies the contents of the file to the given destination file.
- Parameters
| destFile | IN Destination file of the copy operation. |
- Returns
- kTrue if the file was successfully copied, else kFalse.
| virtual void IFileUtility::CreateDirectory | ( | | ) | |
| pure virtual |
Creates the directory if it does not already exists.
| virtual void IFileUtility::DeleteFile | ( | | ) | |
| pure virtual |
Deletes the file from the file system. \ On the Mac, this call can also be used to delete an empty directory.
| virtual bool16 IFileUtility::DirIsReadOnly | ( | | ) | |
| pure virtual |
Tests whether the directory is read-only.
- Returns
- kTrue if the directory is read-only, else kFalse.
| virtual bool16 IFileUtility::FileExists | ( | | ) | |
| pure virtual |
Tests whether the file or directory exists on the file system.
- Returns
- kTrue if exists, else kFalse.
| virtual uint32 IFileUtility::GetCreationDate | ( | | ) | |
| pure virtual |
Returns the date and time the file or directory was created.
- Returns
- Date and time the file or directory was created.
| virtual void IFileUtility::GetDirectory | ( | IDFile & | fileSpec | ) | |
| pure virtual |
Gets the parent path of the file as an IDFile object.
- Parameters
| fileSpec | OUT Parent path of the file as an IDFile object. |
| virtual PMString IFileUtility::GetExtension | ( | | ) | |
| pure virtual |
Returns the file's extension.
- Returns
- File's extension as a string.
| virtual void IFileUtility::GetFileCreatorType | ( | SysOSType * | fileType, | | | SysOSType * | creator | | ) | | |
| pure virtual |
Gets the type and creator of the file. \ Does nothing on Windows.
- Parameters
| fileType | OUT Type of the file. |
| creator | OUT Creator of the file. |
| virtual void IFileUtility::GetFileName | ( | PMString * | fileName | ) | |
| pure virtual |
Gets the file name of the file as a string.
- Parameters
| fileName | OUT Pointer to the string to be set to the file's name. |
| virtual uint32 IFileUtility::GetFileSize | ( | | ) | |
| pure virtual |
Returns the size of a file.
- Returns
- The size of the file. 0 if the file is empty or does not exist.
| virtual bool16 IFileUtility::GetFileVisibility | ( | | ) | |
| pure virtual |
Returns the visibility state of the file.
- Returns
- kTrue if the file is visible, kFalse if it is hidden.
| virtual uint32 IFileUtility::GetModificationDate | ( | | ) | |
| pure virtual |
Returns the date and time the file or directory was last modified.
- Returns
- Date and time the file or directory was last modified.
| virtual void IFileUtility::GetPathName | ( | PMString * | pathName | ) | |
| pure virtual |
Gets the full path of the file as a string.
- Parameters
| pathName | OUT Pointer to the string to be set to the file's full path. |
| virtual const IDFile& IFileUtility::GetSysFile | ( | | ) | |
| pure virtual |
Returns the file as an IDFile object.
- Returns
- Reference to file's IDFile object.
| virtual bool16 IFileUtility::IsAliasFile | ( | | ) | |
| pure virtual |
Tests whether the file is an alias or shortcut.
- Returns
- kTrue if the file is an alias or shortcut, else kFalse.
| virtual bool16 IFileUtility::IsFolder | ( | | ) | |
| pure virtual |
Tests whether this object refers to a existing directory or an alias to a directory.
- Returns
- kTrue if a directory or an alias to a directory, else kFalse.
| virtual bool16 IFileUtility::IsStationery | ( | | ) | |
| pure virtual |
Tests whether file is marked as stationery.
- Returns
- kTrue if the file is marked as stationery, else kFalse.
| virtual ErrorCode IFileUtility::ResolveAliasFile | ( | bool16 | suppressUI = kTrue | ) | |
| pure virtual |
Resolves an alias file by setting the IDFile to the file the alias references.
- Parameters
| suppressUI | IN Denotes whether to prevent the OS from displaying a dialog when the alias cannot be automatically resolved. |
- Returns
- kSuccess if the alias file was successfully resolved,\ kCouldntResolveAliasError if the alias could not be resolved, or\ kFailure if an unexpected error was encountered.
| virtual void IFileUtility::SetFileAsStationery | ( | bool16 | asStationery | ) | |
| pure virtual |
Sets the stationery bit of the file. \ Does nothing on Windows.
- Parameters
| asStationery | IN Denotes whether the stationery bit should be set. |
| virtual void IFileUtility::SetFileCreatorType | ( | SysOSType | fileType, | | | SysOSType | creator | | ) | | |
| pure virtual |
Sets the creator and type of the file. \ Does nothing on Windows.
- Parameters
| fileType | IN Type of the file. |
| creator | IN Creator of the file. |
| virtual bool16 IFileUtility::SetFileReadOnly | ( | bool16 | readOnly = kTrue | ) | |
| pure virtual |
Sets the system's read-only attribute for the file.
- Parameters
| readOnly | IN If kTrue, the file's read-only attribute is set. |
| virtual bool16 IFileUtility::SetFileVisibility | ( | bool16 | show | ) | |
| pure virtual |
Sets the visibility state of the file.
- Parameters
| show | IN Denotes whether the file should be visible or hidden. kTrue to set the file to be visible. |
- Returns
- kTrue if the visibility state of the file was set, else kFalse.
| virtual void IFileUtility::SetUniqueName | ( | | ) | |
| pure virtual |
Ensures that the file name is unique within the directory by appending a unique numerical suffix.