17#define WIN32_LEAN_AND_MEAN
18#include "filesystem.hpp"
21namespace fs = ghc::filesystem;
26 size_t result =
static_cast<size_t>(fs::file_size(fs::path(
m_name),ec));
27 return ec ? 0 : result;
33 bool result = fs::exists(fs::path(
m_name),ec);
40 fs::file_status status = fs::status(
m_name,ec);
41 return !ec && (status.permissions() & fs::perms::owner_write)!=fs::perms::none;
47 fs::file_status status = fs::status(
m_name,ec);
48 return !ec && (status.permissions() & fs::perms::owner_read)!=fs::perms::none;
54 fs::file_status status = fs::status(
m_name,ec);
55 return !ec && (status.permissions() & fs::perms::owner_exec)!=fs::perms::none;
60 return fs::path(
m_name).is_relative();
66 fs::file_status status = fs::status(
m_name,ec);
67 return !ec && fs::is_regular_file(std::move(status));
73 fs::file_status status = fs::status(
m_name,ec);
74 return !ec && fs::is_directory(std::move(status));
80 fs::file_status status = fs::symlink_status(
m_name,ec);
81 return !ec && fs::is_symlink(std::move(status));
87 fs::path targetPath = fs::read_symlink(fs::path(
m_name));
88 return !ec ? targetPath.string() : std::string();
98 std::replace( s.begin(), s.end(),
'\\',
'/' );
106 if (!path.is_relative())
108 result = path.lexically_normal().string();
112 result = (fs::current_path(ec) /
m_name).lexically_normal().string();
120 return fs::path(
m_name).filename().string();
126 size_t pos = s.find(
'.');
127 return pos!=std::string::npos ? s.substr(0,pos) : s;
133 size_t pos = complete ? fn.find(
'.') : fn.rfind(
'.');
134 return pos!=std::string::npos ? fn.substr(pos+1) : std::string();
149 size_t pos = result.rfind(
'/');
150 if (pos==std::string::npos)
160 return result.substr(0,pos);
std::string readLink() const
bool isExecutable() const
std::string extension(bool complete) const
std::string fileName() const
static void correctPath(std::string &s)
std::string dirPath(bool absPath=true) const
std::string filePath() const
std::string baseName() const
std::string absFilePath() const