1#ifndef __JSYSTEM_JFILEJSYSTEM__
2#define __JSYSTEM_JFILEJSYSTEM__
24 inline std::filesystem::path
resolveSymlink(
const std::filesystem::path& file_name)
26 using namespace std::filesystem;
34 catch(
const std::exception&) {
38 const path target = read_symlink(ps);
39 const path next = ps.parent_path() / target;
41 if (!is_symlink(next)) {
46 if (!seen.insert(next).second) {
47 throw std::runtime_error(
"Cyclic symbolic links while resolving " + file_name.string());
70 ls(
const std::string& dir)
72 DIR* top = opendir(dir.c_str());
76 for (dirent* i; (i = readdir(top)) != NULL; ) {
77 this->push_back(i->d_name);
93 inline int rename(
const std::string& inputFile,
98 ifstream in (inputFile .c_str(), ios::binary);
104 return remove(inputFile.c_str());
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for operating system calls.
std::filesystem::path resolveSymlink(const std::filesystem::path &file_name)
Resolve symbolic links.
int rename(const std::string &inputFile, const std::string &outputFile)
Rename file across file systems.
Auxiliary data structure to list files in directory.
ls(const std::string &dir)
Constructor.