6 #ifndef _OS_FILESYSTEM_HPP_ 7 #define _OS_FILESYSTEM_HPP_ 90 virtual Status _rename(
const char* sourcePath,
const char* destPath) = 0;
158 Status _rename(
const char* sourcePath,
const char* destPath)
override;
223 static Status rename(
const char* sourcePath,
const char* destPath);
267 static bool exists(
const char* path);
309 static Status appendFile(
const char* sourcePath,
const char* destPath,
bool createMissingDest=
false);
321 static Status copyFile(
const char* sourcePath,
const char* destPath);
333 static Status moveFile(
const char* sourcePath,
const char* destPath);
FileSystemHandle * getHandle() override
return the underlying FileSystem handle (implementation specific)
virtual Status _getFreeSpace(const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes)=0
Get filesystem free and total space in bytes on the filesystem containing the specified path...
static Status rename(const char *sourcePath, const char *destPath)
Rename a file from source to destination.
static FileSystemInterface * getDelegate(FileSystemHandleStorage &aligned_new_memory)
provide a pointer to a FileSystem delegate object
static Status moveFile(const char *sourcePath, const char *destPath)
Move a file from sourcePath to destPath.
FileSystemInterface()=default
default constructor
static Status getFreeSpace(const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes)
Get filesystem free and total space in bytes on the filesystem containing the specified path...
Status _getWorkingDirectory(char *path, FwSizeType bufferSize) override
Get the current working directory.
static Status removeDirectory(const char *path)
Remove a directory at the specified path.
static Status appendFile(const char *sourcePath, const char *destPath, bool createMissingDest=false)
Append the source file to the destination file.
PlatformSizeType FwSizeType
static bool exists(const char *path)
Return true if the path exists, false otherwise.
virtual ~FileSystemInterface()=default
default virtual destructor
static void init()
initialize singleton
Status _rename(const char *sourcePath, const char *destPath) override
Rename a file from source to destination.
virtual Status _rename(const char *sourcePath, const char *destPath)=0
Rename (or move) a file from source to destination.
static FileSystem & getSingleton()
get a reference to singleton
static constexpr FwSignedSizeType FILE_SYSTEM_FILE_CHUNK_SIZE
Size of file system chunk.
Directory stream has no more files.
Status _removeFile(const char *path) override
Remove a file at the specified path.
U8 FileSystemHandleStorage[FW_FILESYSTEM_HANDLE_MAX_SIZE]
Status _getFreeSpace(const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes) override
Get filesystem free and total space in bytes on the filesystem containing the specified path...
Status _removeDirectory(const char *path) override
Remove a directory at the specified path.
static Status getWorkingDirectory(char *path, FwSizeType bufferSize)
Get the current working directory.
C++-compatible configuration header for fprime configuration.
virtual Status _getWorkingDirectory(char *path, FwSizeType bufferSize)=0
Get the current working directory.
static Status createDirectory(const char *path, bool errorIfAlreadyExists=false)
Create a new directory at the specified path.
#define FW_FILE_CHUNK_SIZE
Chunk size for working with files in the OSAL layer.
static PathType getPathType(const char *path)
Return the type of the path (file, directory, or doesn't exist)
Operand is in use by the system or by a process.
Path is too long, too many sym links, etc.
Operation is not supported by the current implementation.
virtual FileSystemHandle * getHandle()=0
return the underlying FileSystem handle (implementation specific)
FileSystemInterface & operator=(const FileSystemInterface &other)=delete
assignment operator is forbidden
PlatformSignedSizeType FwSignedSizeType
static Status copyFile(const char *sourcePath, const char *destPath)
Copy a file from the source path to the destination path.
static Status getFileSize(const char *path, FwSignedSizeType &size)
Get the size of the file (in bytes) at the specified path.
virtual Status _removeFile(const char *path)=0
Remove a file at the specified path.
Operation was successful.
~FileSystem() final
Destructor.
#define FW_HANDLE_ALIGNMENT
Alignment of handle storage.
virtual Status _removeDirectory(const char *path)=0
Remove a directory at the specified path.
static Status changeWorkingDirectory(const char *path)
Change the current working directory to the specified path.
Status _changeWorkingDirectory(const char *path) override
Change the current working directory to the specified path.
Buffer size is too small to hold full path (for getWorkingDirectory)
static Status removeFile(const char *path)
Remove a file at the specified path.
virtual Status _changeWorkingDirectory(const char *path)=0
Change the current working directory to the specified path.
static Status touch(const char *path)
Touch a file at the specified path, creating it if it doesn't exist.