7 #ifndef _FILESYSTEM_CLASS_HEADER_
8 #define _FILESYSTEM_CLASS_HEADER_
40 ATTRIBUTE_READONLY = 0x00000001,
41 ATTRIBUTE_FOLDER = 0x00000010,
42 ATTRIBUTE_HIDDEN = 0x00000002,
43 ATTRIBUTE_SYSTEM = 0x00000004,
44 ATTRIBUTE_ARCHIVE = 0x00000020,
45 ATTRIBUTE_COMPRESSED = 0x00000800,
46 ATTRIBUTE_ENCRYPTED = 0x00004000,
47 ATTRIBUTE_OFFLINE = 0x00001000,
49 ATTRIBUTE_READONLY = 1,
53 ATTRIBUTE_ARCHIVE = 16,
54 ATTRIBUTE_COMPRESSED = 32,
55 ATTRIBUTE_ENCRYPTED = 64,
56 ATTRIBUTE_OFFLINE = 128,
58 ATTRIBUTE_SYMLINK = 256,
60 ATTRIBUTE_BLOCKDEVICE = 1024,
61 ATTRIBUTE_CHARDEVICE = 2048,
62 ATTRIBUTE_INVALID = 0xFFFFFFFF
96 if (nAttributes != ATTRIBUTE_INVALID)
99 bReadOnly = ((nAttributes & ATTRIBUTE_READONLY) != 0);
100 bFolder = ((nAttributes & ATTRIBUTE_FOLDER) != 0);
101 bHidden = ((nAttributes & ATTRIBUTE_HIDDEN) != 0);
102 bSystem = ((nAttributes & ATTRIBUTE_SYSTEM) != 0);
103 bArchive = ((nAttributes & ATTRIBUTE_ARCHIVE) != 0);
104 bCompressed = ((nAttributes & ATTRIBUTE_COMPRESSED) != 0);
105 bEncrypted = ((nAttributes & ATTRIBUTE_ENCRYPTED) != 0);
106 bOffline = ((nAttributes & ATTRIBUTE_OFFLINE) != 0);
107 bSymLink = ((nAttributes & ATTRIBUTE_SYMLINK) != 0);
108 bPipe = ((nAttributes & ATTRIBUTE_PIPE) != 0);
109 bBlockDevice = ((nAttributes & ATTRIBUTE_BLOCKDEVICE) != 0);
110 bCharDevice = ((nAttributes & ATTRIBUTE_CHARDEVICE) != 0);
139 nAttributes |= ATTRIBUTE_READONLY;
141 nAttributes |= ATTRIBUTE_FOLDER;
143 nAttributes |= ATTRIBUTE_HIDDEN;
145 nAttributes |= ATTRIBUTE_SYSTEM;
147 nAttributes |= ATTRIBUTE_ARCHIVE;
149 nAttributes |= ATTRIBUTE_COMPRESSED;
151 nAttributes |= ATTRIBUTE_ENCRYPTED;
153 nAttributes |= ATTRIBUTE_OFFLINE;
155 nAttributes |= ATTRIBUTE_SYMLINK;
157 nAttributes |= ATTRIBUTE_PIPE;
159 nAttributes |= ATTRIBUTE_BLOCKDEVICE;
161 nAttributes |= ATTRIBUTE_CHARDEVICE;
167 return (
tUInt32)ATTRIBUTE_INVALID;
185 bBlockDevice =
false;
211 PERM_USR_RD = 0x0400,
212 PERM_USR_WR = 0x0200,
213 PERM_USR_EX = 0x0100,
215 PERM_GRP_RD = 0x0040,
216 PERM_GRP_WR = 0x0020,
217 PERM_GRP_EX = 0x0010,
219 PERM_OTH_RD = 0x0004,
220 PERM_OTH_WR = 0x0002,
221 PERM_OTH_EX = 0x0001,
226 } FilePermissionFlag;
476 static tBool LongPathsEnabled();
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
tInt64 tFileSize
type definition for a file or stream size value (platform and compiler independent type).
void tVoid
The tVoid is always the definition for the void (non-type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
uint64_t tUInt64
type definition for unsigned integer values (64bit) (platform and compiler independent type).
tBool bArchive
is archived
cFileAttributes(tUInt32 nAttributes)
Constructor for settings attributes through a bitmask.
cFileAttributes()
Default constructor.
tBool bHidden
is a hidden file/directory,...
tBool bFolder
Is a folder.
tBool bBlockDevice
is a block device
tBool bSymLink
is a symbolic link
tBool bEncrypted
is encrypted
tUInt32 GetAttributes(tUInt32 &nAttributes) const
Returns the attributes as a bitmask.
tBool bCompressed
is compressed
tBool Set(tUInt32 nAttributes)
Set attributes through a bitmask.
tBool bCharDevice
is a character device
tBool bReadOnly
Is readonly.
tBool bSystem
is a system file/directory,...
@ OM_Read
Open existing file.
@ OM_SharedRead
Allows shared read access, use in addition to flags above.
@ OM_SequentialAccess
Optimized for sequential access, use in addition to flags above.
static cFilename GetSysDirectory()
Returns the system directory (e.g.
static tBool IsDirectory(const cFilename &strFilename)
This function checks if the specified filename points to a directory.
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.
static tResult WriteTextFile(const cFilename &strFilename, const cString &strString)
This function creates a text file from an existing cString object.
static tInt GetSectorSize(const cFilename &strFilename)
Get the sector size of the filesystem that a specified file resides on.
static tResult SetFilePermissions(const cFilename &strFilename, tUInt32 nPermissionMask)
Sets the permission set of a file.
static tResult DelFile(const cFilename &strFilename)
Deletes a File.
static tResult CreatePath(const cFilename &strDirName, tBool bRecursive=false)
This function creates a directory.
static tResult GetTimeCreation(const cFilename filename, A_UTILS_NS::cDateTime &dt)
This function returns the creation time of the file.
static tBool IsFile(const cFilename &strFilename)
This function checks if the specified filename points to a file.
static tResult FindFolders(const cString &strPattern, cStringList &lstFolders)
Searches for folders matching a specific pattern.
static tResult FileCopy(const cString &strFrom, const cString &strTo)
Copies a file to another location.
static tResult GetFreeDiskSpace(const tChar *strFolder, tUInt64 *pui64FreeBytes)
Returns the free diskspace on the media that the given path resides on.
static tInt GetLastErrorCode()
Gets the error code of the last failure.
static tBool Exists(const cFilename &strFilename)
This function checks if a file or directory exists.
static tVoid * AllocPageAlignedMemory(tInt nSize, tInt nPageSize=0)
Allocates memory that is page aligned.
static tResult FolderCopy(const cFilename &strFrom, const cFilename &strTo)
Copies a folder recursively to another location.
static tResult SetReadOnly(const cFilename &strFilename, tBool bReadOnly=true)
This function sets or removes the read-only flag for a file.
static tUInt32 GetFilePermissions(const cFilename &strFilename)
Returns the permission set of a file.
static tResult FindFiles(const cString &strPattern, cStringList &lstFiles)
Search for files matching a specific pattern.
static cFilename GetAppDirectory()
Returns the directory where the executable resides.
static tInt GetDefaultSectorSize()
Get the default sector size.
static tFileSize GetFileSize(const cFilename &strFilename)
This function gets the size of a file in bytes.
static tResult GetTimeAccess(const cFilename filename, A_UTILS_NS::cDateTime &dt)
This function returns the last access time of the file.
static tResult Move(const cFilename &strFrom, const cFilename &strTo)
Moves a folder or file.
static tResult RenameFilename(cFilename oldFileName, cFilename newFileName)
The rename function shall change the name of a file.
static cFilename GetOwnModuleDirectory()
For instance a DLL or shared library file is loaded within another application.
static cFilename GetCurDirectory()
Returns the current working directory.
static tResult GetTimeChange(const cFilename filename, A_UTILS_NS::cDateTime &dt)
This function returns the last change (write) time of the file.
static cFilename GetTempDirectory()
Returns the temp directory.
static tResult FreePageAlignedMemory(tVoid *pMemory)
Free memory that has been allocated using AllocPageAlignedMemory.
static tUInt32 m_ui32DefaultSectorSize
the default sector size of the system / drive / device
static cFilename m_strLastBrowseDir
currently not in use
static tBool IsReadOnly(const cFilename &strFilename)
This function checks if a file is read-only.
static tResult EnumDirectory(const cFilename &strDir, cStringList &lstFiles, tUInt32 ui32Flags=0)
Lists all entries in a directory.
static tResult SetCurDirectory(const cFilename &strDirName)
Changes the current working directory.
static cFilename GetUserApplicationDirectory(const cString &strApplication=cString::Empty)
Returns the application data directory of the current user.
static cFilename GetOwnModuleFileName()
The filename of the module (DLL, so, executable) calling this method.
static tUInt32 GetFileAttrib(const cFilename &strFilename)
Get the file attributes of a specified file.
static tResult ExistsLongPathAware(const cFilename &strFilename)
This function checks if a file or directory exists.
static tResult DelDirectory(const cFilename &strDirectory)
Deletes a Directory.
A common result class usable as return value throughout.
static const _myType Empty
Internally used empty string.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
@ ED_FILES
List files in the directory.
@ ED_DIRECTORIES
List directories in the directory.