The base class for file IO stack classes. More...
#include <FileIO.h>
Inherited by AZ::IO::MockFileIOBase.
Public Types | |
typedef AZStd::function< bool(const char *)> | FindFilesCallbackType |
Public Member Functions | |
virtual Result | Open (const char *filePath, OpenMode mode, HandleType &fileHandle)=0 |
virtual Result | Close (HandleType fileHandle)=0 |
virtual Result | Tell (HandleType fileHandle, AZ::u64 &offset)=0 |
virtual Result | Seek (HandleType fileHandle, AZ::s64 offset, SeekType type)=0 |
virtual Result | Read (HandleType fileHandle, void *buffer, AZ::u64 size, bool failOnFewerThanSizeBytesRead=false, AZ::u64 *bytesRead=nullptr)=0 |
virtual Result | Write (HandleType fileHandle, const void *buffer, AZ::u64 size, AZ::u64 *bytesWritten=nullptr)=0 |
virtual Result | Flush (HandleType fileHandle)=0 |
virtual bool | Eof (HandleType fileHandle)=0 |
virtual AZ::u64 | ModificationTime (HandleType fileHandle)=0 |
virtual AZ::u64 | ModificationTime (const char *filePath)=0 |
virtual Result | Size (const char *filePath, AZ::u64 &size)=0 |
Get the size of the file. Returns Success if we report size. | |
virtual Result | Size (HandleType fileHandle, AZ::u64 &size)=0 |
virtual bool | Exists (const char *filePath)=0 |
no fail, returns false if it does not exist | |
virtual bool | IsDirectory (const char *filePath)=0 |
no fail, returns false if its not a directory or does not exist | |
virtual bool | IsReadOnly (const char *filePath)=0 |
no fail, returns false if its read only or does not exist | |
virtual Result | CreatePath (const char *filePath)=0 |
create a path, recursively | |
virtual Result | DestroyPath (const char *filePath)=0 |
virtual Result | Remove (const char *filePath)=0 |
virtual Result | Copy (const char *sourceFilePath, const char *destinationFilePath)=0 |
virtual Result | Rename (const char *originalFilePath, const char *newFilePath)=0 |
virtual Result | FindFiles (const char *filePath, const char *filter, FindFilesCallbackType callback)=0 |
virtual void | SetAlias (const char *alias, const char *path)=0 |
SetAlias - Adds an alias to the path resolution system, e.g. @user@, @products@, etc. | |
virtual void | ClearAlias (const char *alias)=0 |
ClearAlias - Removes an alias from the path resolution system. | |
virtual const char * | GetAlias (const char *alias) const =0 |
GetAlias - Returns the destination path for a given alias, or nullptr if the alias does not exist. | |
virtual void | SetDeprecatedAlias (AZStd::string_view oldAlias, AZStd::string_view newAlias)=0 |
virtual AZStd::optional< AZ::u64 > | ConvertToAlias (char *inOutBuffer, AZ::u64 bufferLength) const =0 |
virtual bool | ConvertToAlias (AZ::IO::FixedMaxPath &convertedPath, const AZ::IO::PathView &path) const =0 |
AZStd::optional< AZ::IO::FixedMaxPath > | ConvertToAlias (const AZ::IO::PathView &path) const |
virtual bool | ResolvePath (const char *path, char *resolvedPath, AZ::u64 resolvedPathSize) const =0 |
virtual bool | ResolvePath (AZ::IO::FixedMaxPath &resolvedPath, const AZ::IO::PathView &path) const =0 |
AZStd::optional< AZ::IO::FixedMaxPath > | ResolvePath (const AZ::IO::PathView &path) const |
virtual bool | ReplaceAlias (AZ::IO::FixedMaxPath &replacedAliasPath, const AZ::IO::PathView &path) const =0 |
virtual bool | GetFilename (HandleType fileHandle, char *filename, AZ::u64 filenameSize) const =0 |
Divulge the filename used to originally open that handle. | |
virtual bool | IsRemoteIOEnabled () |
Static Public Member Functions | |
static FileIOBase * | GetInstance () |
static void | SetInstance (FileIOBase *instance) |
static FileIOBase * | GetDirectInstance () |
static void | SetDirectInstance (FileIOBase *instance) |
The base class for file IO stack classes.
typedef AZStd::function<bool(const char*)> AZ::IO::FileIOBase::FindFilesCallbackType |
FindFiles - return all files and directories matching that filter (dos-style filters) at that file path does not recurse. does not return the . or .. directories not all filters are supported. You must include <AzCore/std/functional.h> if you use this note: the callback will contain the full concatenated path (filePath + slash + fileName) not just the individual file name found. note: if the file path of the found file corresponds to a registered ALIAS, the longest matching alias will be returned so expect return values like @products@/textures/mytexture.dds instead of a full path. This is so that fileIO works over remote connections. note: if rootPath is specified the implementation has the option of substituting it for the current directory as would be the case on a file server.
|
pure virtual |
ConvertToAlias - Converts the start of the path to alias form. i.e @alias@/... if possible i.e if
Implemented in AZ::IO::MockFileIOBase.
|
pure virtual |
Shorten the given path if it contains an alias. it will always pick the longest alias match. note that it re-uses the buffer, since the data can only get smaller and we don't want to internally allocate memory if we can avoid it. If for some reason the @alias@ is longer than the path it represents and the path cannot fit in the buffer a nullopt is returned, otherwise it returns the length of the result
Implemented in AZ::IO::MockFileIOBase.
|
pure virtual |
does not overwrite the destination if it exists. note that attributes are not required to be copied the modtime of the destination path must be equal or greater than the source path but doesn't have to be equal (some operating systems forbid modifying modtimes due to security constraints)
|
pure virtual |
DestroyPath - Destroys the entire path and all of its contents (all files, all subdirectories, etc) succeeds if the directory was successfully destroys succeeds if the directory didn't exist in the first place fails if the path could not be destroyed (for example, if a file could not be erased for any reason) also fails if filePath refers to a file name which exists instead of a directory name. It must be a directory name.
|
static |
|
static |
GetInstance() A utility function to get the one global instance of File IO to use when talking to engine. returns an instance which is aware of concepts such as pak and loose files and can be used to interact with them. Note that the PAK system itself should not call GetInstance but instead should use the direct underlying IO system using GetDirectInstance instead since otherwise an infinite loop will be caused.
|
pure virtual |
the only requirement on the ModTime functions is that it must be comparable with subsequent calls to the same function. there is no specific requirement that they be cross-platform or adhere to any standard, but they should still be comparable across sessions.
|
pure virtual |
Remove - erases a single file succeeds if the file didn't exist to begin with succeeds if the file did exist and we successfully erased it. fails if the file cannot be erased also fails if the specified filePath is actually a directory that exists (instead of a file)
|
pure virtual |
renames a file or directory name also fails if the file or directory cannot be found also succeeds if originalFilePath == newFilePath
|
pure virtual |
ReplaceAliases - If the path starts with an ...@ alias it is substituted with the alias value otherwise the path is copied as is to the resolvedAlias path value returns true if the resulting path can fit within AZ::IO::FixedMaxPath buffer
|
pure virtual |
ResolvePath - Replaces any @ aliases in the supplied path with their the resolved alias values Converts the path to an absolute path, and replaces path separators with unix slashes The resolved path is returned in as a FixedMaxPath, unless it is longer than MaxPathLength in which case a null optional is returned
Implemented in AZ::IO::MockFileIOBase.
|
pure virtual |
ResolvePath - Replaces any aliases in path with their values and stores the result in resolvedPath, also ensures that the path is absolute NOTE: If the path does not start with an alias then the resolved value of the @products@ is used which has the effect of making the path relative to the @products@/ folder returns true if path was resolved, false otherwise note that all of the above file-finding and opening functions automatically resolve the path before operating so you should not need to call this except in very exceptional circumstances where you absolutely need to hit a physical file and don't want to use SystemFile
Implemented in AZ::IO::MockFileIOBase.
|
pure virtual |
SetDeprecateAlias - Adds a deprecated alias with path resolution which points to a new alias When the DeprecatedAlias is used an Error is logged and the alias is resolved to the path specified by the new alais