56 virtual bool accept(
const string& path,
const string& file) = 0;
65 static const string composeURI(
const string& pathName,
const string& fileName);
74 static uint64_t
getFileSize(
const string& pathName,
const string& fileName);
83 static const string getContentAsString(
const string& pathName,
const string& fileName);
92 static void setContentFromString(
const string& pathName,
const string& fileName,
const string& content);
101 static void getContent(
const string& pathName,
const string& fileName, vector<uint8_t>& content);
110 static void setContent(
const string& pathName,
const string& fileName,
const vector<uint8_t>& content);
140 static void list(
const string& pathName, vector<string>& files,
FileNameFilter* filter =
nullptr,
bool addDrives =
false);
148 static bool isPath(
const string& uri);
155 static bool isDrive(
const string& uri);
163 static bool exists(
const string& uri);
171 static const string getCanonicalURI(
const string& pathName,
const string& fileName);
185 static void changePath(
const string& pathName);
192 static const string getPathName(
const string& uri);
199 static const string getFileName(
const string& uri);
213 static void createPath(
const string& pathName);
222 static void removePath(
const string& pathName,
bool recursive);
231 static void removeFile(
const string& pathName,
const string& fileName);
239 static void rename(
const string& fileNameFrom,
const string& fileNameTo);
minitscript::utilities::ExceptionBase _ExceptionBase
FileSystemException(const string &message)
Public constructor.
static const string removeFileExtension(const string &fileName)
Remove file extension, e.g.
static bool isDrive(const string &uri)
Check if file is a drive (applies to Microsoft Windows only)
static void setContentFromString(const string &pathName, const string &fileName, const string &content)
Set content from string.
static const string composeURI(const string &pathName, const string &fileName)
Compose URI from path name and file name.
static const string getPathName(const string &uri)
Get path name.
static const string getCanonicalURI(const string &pathName, const string &fileName)
Get canonical URI from given path name and file name.
static void createPath(const string &pathName)
Create path.
static void list(const string &pathName, vector< string > &files, FileNameFilter *filter=nullptr, bool addDrives=false)
List files for given path and filter by a file name filter if not null.
static void changePath(const string &pathName)
Change path.
static void removePath(const string &pathName, bool recursive)
Remove path.
static void setContent(const string &pathName, const string &fileName, const vector< uint8_t > &content)
Set file content.
static void getContent(const string &pathName, const string &fileName, vector< uint8_t > &content)
Get file content.
static void setContentFromStringArray(const string &pathName, const string &fileName, const vector< string > &content)
Set file content as string array.
static void removeFile(const string &pathName, const string &fileName)
Remove file.
static uint64_t getFileSize(const string &pathName, const string &fileName)
Return file size of given file.
static void getContentAsStringArray(const string &pathName, const string &fileName, vector< string > &content)
Get file content as string array.
static const string getFileName(const string &uri)
Get file name.
static bool isPath(const string &uri)
Check if file is a path.
static bool exists(const string &uri)
Check if file exists.
static const string getCurrentWorkingPathName()
Get current working path name.
static const string getContentAsString(const string &pathName, const string &fileName)
Get content as string.
static void rename(const string &fileNameFrom, const string &fileNameTo)
Rename file.
File system file name filter interface.
virtual bool accept(const string &path, const string &file)=0
Accept a file.
virtual ~FileNameFilter()
Destructor.