mirror of
https://github.com/AxioDL/LibCommon.git
synced 2026-03-30 11:47:23 -07:00
7f20a5ef97
Makes any future potential of a class unlikely.
51 lines
2.3 KiB
C++
51 lines
2.3 KiB
C++
#ifndef AXIO_FILEUTIL_H
|
|
#define AXIO_FILEUTIL_H
|
|
|
|
#include "TString.h"
|
|
#include <vector>
|
|
|
|
namespace FileUtil
|
|
{
|
|
|
|
bool Exists(const TString& rkFilePath);
|
|
bool IsRoot(const TString& rkPath);
|
|
bool IsFile(const TString& rkFilePath);
|
|
bool IsDirectory(const TString& rkDirPath);
|
|
bool IsDirectoryWritable(const TString& rkDirPath);
|
|
bool IsAbsolute(const TString& rkDirPath);
|
|
bool IsRelative(const TString& rkDirPath);
|
|
bool IsEmpty(const TString& rkDirPath);
|
|
bool MakeDirectory(const TString& rkNewDir);
|
|
bool CopyFile(const TString& rkOrigPath, const TString& rkNewPath);
|
|
bool CopyDirectory(const TString& rkOrigPath, const TString& rkNewPath);
|
|
bool MoveFile(const TString& rkOldPath, const TString& rkNewPath);
|
|
bool MoveDirectory(const TString& rkOldPath, const TString& rkNewPath);
|
|
bool DeleteFile(const TString& rkFilePath);
|
|
bool DeleteDirectory(const TString& rkDirPath, bool FailIfNotEmpty); // This is an extremely destructive function, be careful using it!
|
|
bool ClearDirectory(const TString& rkDirPath); // This is an extremely destructive function, be careful using it!
|
|
void MarkHidden(const TString& rkFilePath, bool Hidden);
|
|
void UpdateLastModifiedTime(const TString& rkFilePath);
|
|
uint64_t FileSize(const TString& rkFilePath);
|
|
uint64_t LastModifiedTime(const TString& rkFilePath);
|
|
TString WorkingDirectory();
|
|
TString MakeAbsolute(TString Path);
|
|
TString MakeRelative(const TString& rkPath, const TString& rkRelativeTo = WorkingDirectory());
|
|
TString SimplifyRelativePath(const TString& rkPath);
|
|
uint32_t MaxFileNameLength();
|
|
TString SanitizeName(TString Name, bool Directory, bool RootDir = false);
|
|
TString SanitizePath(TString Path, bool Directory);
|
|
bool IsValidFileNameCharacter(char Chr);
|
|
bool IsValidName(const TString& rkName, bool Directory, bool RootDir = false);
|
|
bool IsValidPath(const TString& rkPath, bool Directory);
|
|
void GetDirectoryContents(TString DirPath, TStringList& rOut, bool Recursive = true, bool IncludeFiles = true, bool IncludeDirs = true);
|
|
TString FindFileExtension(const TString& rkDir, const TString& rkName);
|
|
bool LoadFileToString(const TString& rkFilePath, TString& rOut);
|
|
bool LoadFileToBuffer(const TString& rkFilePath, std::vector<uint8_t>& Out);
|
|
bool SaveStringToFile(const TString& rkFilePath, const TString& kString);
|
|
bool SaveBufferToFile(const TString& rkFilePath, const std::vector<uint8_t>& kBuffer);
|
|
|
|
}
|
|
|
|
#endif // AXIO_FILEUTIL_H
|
|
|