23 #ifndef __ccxx_File_hxx 24 #define __ccxx_File_hxx 149 bool isDirectory()
const;
163 bool isSymLink()
const;
211 bool lockRange(uint64_t start, uint64_t length,
LockType type,
223 bool unlockRange(uint64_t start, uint64_t length);
236 void truncate(uint64_t size = 0);
260 static bool makeDirectory(
261 const String& path,
bool createAll =
false,
271 static bool remove(
const String& path);
281 static bool removeDirectory(
const String& path);
291 static bool removeDirectoryTree(
const String& path);
299 static bool exists(
const String& path);
308 static bool isDirectory(
const String& path);
317 static bool isFile(
const String& path);
326 static bool isPipe(
const String& path);
336 static bool isSymLink(
const String& path);
347 static bool readSymLink(
String& path);
357 static bool resolveSymLink(
String& path);
369 static bool createLink(
const String& oldPath,
const String& newPath,
370 bool hardLink =
false);
408 static int64_t getSize(
const String& path);
417 static bool rename(
const String& oldName,
const String& newName);
426 static bool copy(
const String& oldFile,
const String& newFile);
436 static bool move(
const String& oldFile,
const String& newFile);
445 static bool touch(
const String& path);
467 static void getFileSystemRoots(
StringVec& roots,
bool localOnly =
true);
476 static void setCreationMask(
const Permissions& perm);
488 static uint64_t getDiskFreeSpace(
const String& path);
500 static size_t getDiskBlockSize(
const String& path);
511 static int64_t roundSizeToBlockSize(
const int64_t& fileSize,
520 static String removeTrailingSeparators(
const String& path);
530 static const char validSeparators[];
536 static bool isValidSeparator(
char c);
542 static bool isValidSeparator(
char16_t c);
545 static const char separatorString[];
561 #endif // __ccxx_File_hxx
IOMode
Stream I/O modes.
Definition: Stream.h++:36
#define UINT64_CONST(I)
Declare an unsigned 64-bit integer constant I.
Definition: Integers.h++:123
bool isFile() const
Test if the file is a plain file.
Definition: File.h++:100
time_ms_t modified
File last-modified time.
Definition: File.h++:87
A String vector.
Definition: String.h++:1159
int64_t time_ms_t
A time expressed in milliseconds since the epoch (00:00:00, UTC, January 1, 1970).
Definition: Integers.h++:98
An unbuffered I/O stream.
Definition: Stream.h++:60
Open and truncate the file if it exists, otherwise fail.
Definition: File.h++:61
time_ms_t accessed
File last-accessed time.
Definition: File.h++:89
static const char * eol
The host system's end-of-line character sequence.
Definition: File.h++:548
FileOpenMode
File open modes.
Definition: File.h++:53
Lock for writing.
Definition: File.h++:109
FileType
File types.
Definition: File.h++:35
Permissions permissions
File access permissions.
Definition: File.h++:93
Directory.
Definition: File.h++:39
FileType type
File type.
Definition: File.h++:83
Read/write mode.
Definition: Stream.h++:42
Lock for reading.
Definition: File.h++:107
A representation of a file in the filesystem.
Definition: File.h++:118
LockType
File lock types.
Definition: File.h++:105
Named pipe.
Definition: File.h++:43
Open the file if it exists, otherwise create the file.
Definition: File.h++:55
time_ms_t created
File creation time (not available on all platforms).
Definition: File.h++:85
static const Permissions defaultDirPerms
Default permissions for directories: read, write & execute for user, read & execute for group...
Definition: Permissions.h++:256
static const char separator
The host system's file separator character.
Definition: File.h++:523
Open the file if it exists, otherwise fail.
Definition: File.h++:57
File attributes.
Definition: File.h++:71
#define COMMONCPP_API
Definition: Common.h++:126
FileAttributes()
Constructor.
Definition: File.h++:74
String getPath() const
Get the pathname for the file.
Definition: File.h++:239
#define INT64_CONST(I)
Declare a signed 64-bit integer constant I.
Definition: Integers.h++:122
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
String _name
Definition: File.h++:552
uint64_t size
File size, in bytes.
Definition: File.h++:91
Symbolic link.
Definition: File.h++:41
bool isDirectory() const
Test if the file is a directory.
Definition: File.h++:96
Create the file if it does not exist, otherwise fail.
Definition: File.h++:59
uint16_t char16_t
A UTF-16 character.
Definition: Common.h++:201
Regular file.
Definition: File.h++:37
#define CCXX_COPY_DECLS(CLASS)
Inlines declarations of a copy constructor and assignment operator for the class CLASS.
Definition: Common.h++:295
File permissions.
Definition: Permissions.h++:38
Unknown filetype.
Definition: File.h++:49
Device file.
Definition: File.h++:45
static const int USER_READ_WRITE
User read and write mask.
Definition: Permissions.h++:62
Definition: AllocationMap.c++:25
Other filetype.
Definition: File.h++:47
Open and truncate the file if it exists, otherwise create the file.
Definition: File.h++:63