2#ifndef STORMM_FILE_LISTING_H
3#define STORMM_FILE_LISTING_H
14enum class SearchStyle {
15 RECURSIVE, NON_RECURSIVE
20enum class DrivePathType {
21 FILE, DIRECTORY, REGEXP
25enum class OperatingSystem {
26 LINUX, UNIX, WINDOWS, MAC_OS
32constexpr OperatingSystem detected_os = OperatingSystem::LINUX;
33#elif defined(unix) || defined(__unix) || defined(__unix__)
34constexpr OperatingSystem detected_os = OperatingSystem::UNIX;
35#elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
36constexpr OperatingSystem detected_os = OperatingSystem::WINDOWS;
37#elif defined(__APPLE__) || defined(__MACH__)
38constexpr OperatingSystem detected_os = OperatingSystem::MAC_OS;
48DrivePathType getDrivePathType(
const std::string &path);
55std::vector<std::string> listDirectory(
const std::string &path,
56 SearchStyle r_option = SearchStyle::NON_RECURSIVE,
57 DrivePathType entity_kind = DrivePathType::FILE);
63bool pathIsAbsolute(
const std::string &path);
68std::string makePathAbsolute(
const std::string &path);
73std::string getNormPath(
const std::string &path);
78std::string getBaseName(
const std::string &path);
86std::string substituteNameExtension(
const std::string &path,
const std::string &new_ext);
91std::vector<std::string> separatePath(
const std::string &path);
98void splitPath(
const std::string &path, std::string *before, std::string *after);
112std::vector<std::string> listFilesInPath(
const std::string ®exp_path, SearchStyle r_option);
120std::string findStormmPath(
const std::string &path,
const std::string &extension);
127std::string commonPathVariableName(
int index);
141std::vector<std::string> extractCommonPaths(std::vector<std::string> *input_paths,
142 int n_shortcut = 2,
int n_instance = 2);
148std::string listCommonPaths(
const std::vector<std::string> &shortcuts,
int indentation = 2);