ES-DE/es-core/src/utils/FileSystemUtil.h

68 lines
2.7 KiB
C
Raw Normal View History

2020-06-22 15:27:53 +00:00
//
// FileSystemUtil.h
//
// Low-level filesystem functions.
// Resolve relative paths, resolve symlinks, create directories,
// remove files etc.
2020-06-22 15:27:53 +00:00
//
#pragma once
2017-11-22 21:29:52 +00:00
#ifndef ES_CORE_UTILS_FILE_SYSTEM_UTIL_H
#define ES_CORE_UTILS_FILE_SYSTEM_UTIL_H
#include <list>
#include <string>
namespace Utils
{
2020-06-22 15:27:53 +00:00
namespace FileSystem
{
typedef std::list<std::string> stringList;
2020-06-22 15:27:53 +00:00
stringList getDirContent(const std::string& _path,
const bool _recursive = false);
stringList getPathList(const std::string& _path);
void setHomePath(const std::string& _path);
std::string getHomePath();
std::string getCWDPath();
2020-07-10 17:53:33 +00:00
std::string getPathToBinary(const std::string& executable);
2020-06-22 15:27:53 +00:00
void setExePath(const std::string& _path);
std::string getExePath();
std::string getProgramDataPath();
2020-06-22 15:27:53 +00:00
std::string getPreferredPath(const std::string& _path);
std::string getGenericPath(const std::string& _path);
std::string getEscapedPath(const std::string& _path);
std::string getCanonicalPath(const std::string& _path);
std::string getAbsolutePath(const std::string& _path,
const std::string& _base = getCWDPath());
std::string getParent(const std::string& _path);
std::string getFileName(const std::string& _path);
std::string getStem(const std::string& _path);
std::string getExtension(const std::string& _path);
std::string expandHomePath(const std::string& _path);
2020-06-22 15:27:53 +00:00
std::string resolveRelativePath(const std::string& _path,
const std::string& _relativeTo, const bool _allowHome);
std::string createRelativePath(const std::string& _path,
const std::string& _relativeTo, const bool _allowHome);
std::string removeCommonPath(const std::string& _path,
const std::string& _common, bool& _contains);
std::string resolveSymlink(const std::string& _path);
bool copyFile(const std::string& _source_path,
const std::string& _destination_path, bool _overwrite);
bool renameFile(const std::string& _source_path,
const std::string& _destination_path, bool _overwrite);
2020-06-22 15:27:53 +00:00
bool removeFile(const std::string& _path);
2020-06-22 15:27:53 +00:00
bool createDirectory(const std::string& _path);
bool exists(const std::string& _path);
bool driveExists(const std::string& _path);
2020-06-22 15:27:53 +00:00
bool isAbsolute(const std::string& _path);
bool isRegularFile(const std::string& _path);
bool isDirectory(const std::string& _path);
bool isSymlink(const std::string& _path);
bool isHidden(const std::string& _path);
}
}
2017-11-22 21:29:52 +00:00
#endif // ES_CORE_UTILS_FILE_SYSTEM_UTIL_H