ADTF
3.18.2
|
File system class. More...
Public Types | |
enum | { ED_DEFAULT = 0x0 , ED_FILES = 0x1 , ED_DIRECTORIES = 0x2 } |
enum | FilePermissionFlag { PERM_USR_RD = 0x0400 , PERM_USR_WR = 0x0200 , PERM_USR_EX = 0x0100 , PERM_GRP_RD = 0x0040 , PERM_GRP_WR = 0x0020 , PERM_GRP_EX = 0x0010 , PERM_OTH_RD = 0x0004 , PERM_OTH_WR = 0x0002 , PERM_OTH_EX = 0x0001 , PERM_SUID = 0x4000 , PERM_SGID = 0x2000 , PERM_SVTX = 0x1000 } |
File permission flags. More... | |
Static Public Member Functions | |
static tUInt32 | GetFileAttrib (const cFilename &strFilename) |
Get the file attributes of a specified file. More... | |
static tResult | ReadTextFile (const cFilename &strFilename, cString &strString, const tUInt32 &ui32OpenMode=cFile::OM_Read|cFile::OM_SharedRead|cFile::OM_SequentialAccess) |
This function reads a complete text file into a cString object. More... | |
static tResult | WriteTextFile (const cFilename &strFilename, const cString &strString) |
This function creates a text file from an existing cString object. More... | |
static tBool | Exists (const cFilename &strFilename) |
This function checks if a file or directory exists. More... | |
static tFileSize | GetFileSize (const cFilename &strFilename) |
This function gets the size of a file in bytes. More... | |
static tBool | IsFile (const cFilename &strFilename) |
This function checks if the specified filename points to a file. More... | |
static tBool | IsDirectory (const cFilename &strFilename) |
This function checks if the specified filename points to a directory. More... | |
static tResult | CreatePath (const cFilename &strDirName, tBool bRecursive=false) |
This function creates a directory. More... | |
static tBool | IsReadOnly (const cFilename &strFilename) |
This function checks if a file is read-only. More... | |
static tResult | SetReadOnly (const cFilename &strFilename, tBool bReadOnly=true) |
This function sets or removes the read-only flag for a file. More... | |
static tResult | DelFile (const cFilename &strFilename) |
Deletes a File. More... | |
static tResult | DelDirectory (const cFilename &strDirectory) |
Deletes a Directory. More... | |
static cFilename | GetCurDirectory () |
Returns the current working directory. More... | |
static tResult | SetCurDirectory (const cFilename &strDirName) |
Changes the current working directory. More... | |
static cFilename | GetAppDirectory () |
Returns the directory where the executable resides. More... | |
static cFilename | GetSysDirectory () |
Returns the system directory (e.g. More... | |
static cFilename | GetOwnModuleFileName () |
The filename of the module (DLL, so, executable) calling this method. More... | |
static cFilename | GetOwnModuleDirectory () |
For instance a DLL or shared library file is loaded within another application. More... | |
static cFilename | GetUserApplicationDirectory (const cString &strApplication=cString::Empty) |
Returns the application data directory of the current user. More... | |
static cFilename | GetTempDirectory () |
Returns the temp directory. More... | |
static tResult | FileCopy (const cString &strFrom, const cString &strTo) |
Copies a file to another location. More... | |
static tResult | FolderCopy (const cFilename &strFrom, const cFilename &strTo) |
Copies a folder recursively to another location. More... | |
static tResult | Move (const cFilename &strFrom, const cFilename &strTo) |
Moves a folder or file. More... | |
static tUInt32 | GetFilePermissions (const cFilename &strFilename) |
Returns the permission set of a file. More... | |
static tResult | SetFilePermissions (const cFilename &strFilename, tUInt32 nPermissionMask) |
Sets the permission set of a file. More... | |
static tInt | GetDefaultSectorSize () |
Get the default sector size. More... | |
static tInt | GetSectorSize (const cFilename &strFilename) |
Get the sector size of the filesystem that a specified file resides on. More... | |
static tVoid * | AllocPageAlignedMemory (tInt nSize, tInt nPageSize=0) |
Allocates memory that is page aligned. More... | |
static tResult | FreePageAlignedMemory (tVoid *pMemory) |
Free memory that has been allocated using AllocPageAlignedMemory. More... | |
static tResult | EnumDirectory (const cFilename &strDir, cStringList &lstFiles, tUInt32 ui32Flags=0) |
Lists all entries in a directory. More... | |
static tResult | GetFreeDiskSpace (const tChar *strFolder, tUInt64 *pui64FreeBytes) |
Returns the free diskspace on the media that the given path resides on. More... | |
static tResult | FindFiles (const cString &strPattern, cStringList &lstFiles) |
Search for files matching a specific pattern. More... | |
static tResult | FindFolders (const cString &strPattern, cStringList &lstFolders) |
Searches for folders matching a specific pattern. More... | |
static tResult | GetTimeAccess (const cFilename filename, A_UTILS_NS::cDateTime &dt) |
This function returns the last access time of the file. More... | |
static tResult | GetTimeCreation (const cFilename filename, A_UTILS_NS::cDateTime &dt) |
This function returns the creation time of the file. More... | |
static tResult | GetTimeChange (const cFilename filename, A_UTILS_NS::cDateTime &dt) |
This function returns the last change (write) time of the file. More... | |
static tInt | GetLastErrorCode () |
Gets the error code of the last failure. More... | |
static tResult | RenameFilename (cFilename oldFileName, cFilename newFileName) |
The rename function shall change the name of a file. More... | |
Static Protected Attributes | |
static cFilename | m_strLastBrowseDir |
currently not in use More... | |
static tUInt32 | m_ui32DefaultSectorSize |
the default sector size of the system / drive / device | |
File system class.
Definition at line 195 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/filesystem.h.
enum FilePermissionFlag |
File permission flags.
Definition at line 209 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/filesystem.h.
Allocates memory that is page aligned.
nSize | [in] How much memory should be allocated (Bytes). |
nPageSize | [in] The size of a page, autodetected if = 0. |
This function creates a directory.
If the parent directory structure doesn't exist, the bRecursive option causes this to be created as well.
strDirName | [in] Path or name of directory to be created. |
bRecursive | [in] Flag for creating the whole parent directory structure. |
ERR_EMPTY | if path or name of directory is empty. |
ERR_INVALID_FILE | if a file with the same name already exists. |
ERR_FAILED | if share does not exist and path could not be created. |
ERR_NOERROR | if succeeded or a directory with the same name already exists (it doesn't matter if the existing directory is empty or not). |
Deletes a Directory.
strDirectory | [in] name of the directory to be deleted. |
ERR_INVALID_FILE | if cFileSystem::Exists() failed. |
ERR_ACCESS_DENIED | if failed. |
ERR_NOERROR | if succeeded. |
Deletes a File.
strFilename | [in] name of the file to be deleted. |
ERR_ACCESS_DENIED | if failed. |
ERR_NOERROR | if succeeded. |
|
static |
Lists all entries in a directory.
strDir | [in] The directory. |
lstFiles | [out] The list of entries. |
ui32Flags | [in] Whether to list files (ED_FILES) or directories (ED_DIRECTORIES). Default is files only. |
Standard | Result Code. |
ERR_INVALID_HANDLE | if handle value is invalid. |
ERR_NOERROR | if succeeded. |
This function checks if a file or directory exists.
strFilename | [in] Path of file or directory to be checked for. |
ERR_INVALID_FILE | if file does net exists. |
ERR_NOERROR | if succeeded. |
Copies a file to another location.
strFrom | [in] The source filename. |
strTo | [in] The destination filename. |
Standard | Result Code. |
ERR_OPEN_FAILED | if source & destination file could not be open. |
ERR_MEMORY | if buffer could not be created. |
ERR_FAILED | file could not be copied. |
ERR_NOERROR | if succeeded. |
|
static |
Search for files matching a specific pattern.
The pattern strPattern can be a relative or absolute filepath. The pattern has to be of one of the following forms:
root/a.file
: returns a.file
, if exists root/*.file
: match all files with ending .file
in the root folder root/*
: returns all files in root folder (no recursion!) root/*.*
: same as root/*
root/*/a.file
: search for a.file
in every subfolder of root (no recursion!) root/**/*.*
: returns all files in root and every subfolder recursively! root/**/*
: same as root/**/*.*
root/**/sub/a.file
: search for sub/a.file
in every subfolder of root recursively root/a*cc.file
: use * as a wildcard within filenames. strPattern | [in] The pattern to match. |
lstFiles | [out] The list of found files. |
ERR_NOERROR | if files are found, |
ERR_NOT_FOUND | otherwise. |
|
static |
Searches for folders matching a specific pattern.
Wildcard * is the only one allowed.
strPattern | [in] The pattern to match. |
lstFolders | [out] The list of found folders. |
ERR_NOERROR | if folders are found, |
ERR_NOT_FOUND | otherwise. |
Copies a folder recursively to another location.
strFrom | [in] The source folder. |
strTo | [in] The destination filename. |
Standard | Result Code. |
ERR_PATH_NOT_FOUND | if copy folder is no directory. |
ERR_OPEN_FAILED | if source & destination file could not be open. |
ERR_MEMORY | if buffer could not be created. |
ERR_FAILED | file could not be copied. |
ERR_NOERROR | if succeeded. |
Free memory that has been allocated using AllocPageAlignedMemory.
pMemory | [in] Pointer the the allocated memory. |
Standard | Result Code. |
ERR_MEMORY | if memory could not be released. |
ERR_NOERROR | if succeeded. |
|
static |
Returns the directory where the executable resides.
|
static |
Returns the current working directory.
|
static |
Get the default sector size.
Get the file attributes of a specified file.
strFilename | [in] The filename. |
Returns the permission set of a file.
Currently only implemented for Linux.
strFilename | [in] The filename. |
This function gets the size of a file in bytes.
strFilename | [in] name of the file |
Returns the free diskspace on the media that the given path resides on.
strFolder | [in] The pathname. Must be absolute! |
pui64FreeBytes | [out] The free space in bytes, or ERR_INVALID_ARG, ERR_FAILED in case of failure or if strFolder was nullptr. |
Standard | Result Code. |
ERR_INVALID_ARG | if strFolder is nullptr. |
ERR_FAILED | if free disk space could not be calculated. |
ERR_NOERROR | if succeeded. |
|
static |
Gets the error code of the last failure.
|
static |
For instance a DLL or shared library file is loaded within another application.
This function - called within the DLL or shared library file - returns the directory where the file resides in the file system. In other words: if called within a DLL or shared library file, it returns the own file system path of the file itself.
|
static |
The filename of the module (DLL, so, executable) calling this method.
Get the sector size of the filesystem that a specified file resides on.
strFilename | [in] The filename. |
|
static |
Returns the system directory (e.g.
system32 or /etc on unix).
|
static |
Returns the temp directory.
|
static |
This function returns the last access time of the file.
dt | A_UTILS_NS::cDateTime of the last access |
filename | cFilename of the file to be checked |
OK | if the time has been retrieved |
ERR_INVALID_ARG | if filename is empty |
ERR_UNKNOWN | if time cannot be read |
|
static |
This function returns the last change (write) time of the file.
dt | A_UTILS_NS::cDateTime of the last access |
filename | cFilename of the file to be checked |
OK | if the time has been retrieved |
ERR_INVALID_ARG | if filename is empty |
ERR_UNKNOWN | if time cannot be read; |
|
static |
This function returns the creation time of the file.
dt | A_UTILS_NS::cDateTime of the last access |
filename | cFilename of the file to be checked |
OK | if the time has been retrieved |
ERR_INVALID_ARG | if filename is empty |
ERR_UNKNOWN | if time cannot be read; |
|
static |
Returns the application data directory of the current user.
[in] | strApplication | additional path to be added to the user directory |
This function checks if the specified filename points to a directory.
strFilename | [in] Path of directory to be checked for. |
This function checks if the specified filename points to a file.
strFilename | [in] Path of file to be checked for. |
This function checks if a file is read-only.
strFilename | [in] Path of file to be checked. |
Moves a folder or file.
strFrom | [in] The source filename. |
strTo | [in] The destination filename. |
Standard | Result Code. |
ERR_PATH_NOT_FOUND | if folder could not be copied. |
ERR_FILE_NOT_FOUND | if file could not be copied. |
ERR_NOERROR | if succeeded. |
|
static |
This function reads a complete text file into a cString object.
strFilename | [in] Path of file to be read. |
strString | [in] cString object to be filled. |
ui32OpenMode | [in] Open Mode of the File see cFile::tOpenMode (should be at least cFile::OM_Read) |
ERR_INVALID_FLAGS | if ui32OpenMode isn't at least cFile::OM_Read or cFile::OM_SequentialAccess, otherwise ERR_OPEN_FAILED. |
ERR_OUT_OF_RANGE | if string buffer is on invalid position. |
ERR_NOERROR | if succeeded. |
The rename function shall change the name of a file.
oldFileName | The old argument points to the pathname of the file to be renamed |
newFileName | The new argument points to the new pathname of the file |
Standard | Result Code. |
ERR_UNKNOWN | if file could not be renamed. |
ERR_NOERROR | if succeeded. |
Changes the current working directory.
strDirName | [in] The path to the new working directory. |
ERR_PATH_NOT_FOUND | if directory was not found. |
ERR_FAILED | if current directory could not be set. |
ERR_NOERROR | if succeeded. |
Sets the permission set of a file.
Currently only implemented for Linux.
strFilename | [in] The filename. |
nPermissionMask | [in] The new permission set. |
Standard | Result Code. |
ERR_PATH_MEMORY | if memory problem occours. |
ERR_FAILED | if PermissionMask failed. |
ERR_NOERROR | if succeeded. |
This function sets or removes the read-only flag for a file.
strFilename | [in] Path of file to be modified. |
bReadOnly | [in] Set or remove the read only flag. |
ERR_FAILED | if set read only failed. |
ERR_NOERROR | if succeeded. |
This function creates a text file from an existing cString object.
strFilename | [in] Path of file to be written. |
strString | [in] cString object as data source. |
ERR_OPEN_FAILED | if cFile::OM_Write failed |
ERR_NOERROR | if succeeded. |
|
staticprotected |
currently not in use
Definition at line 230 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/filesystem.h.