12 #ifndef SST_CORE_FILESYSTEM_H 13 #define SST_CORE_FILESYSTEM_H 134 FILE*
fopen(
const std::string& filename,
const char* mode);
170 std::ofstream
ofstream(
const std::string& filename, std::ios_base::openmode mode = std::ios_base::out);
205 static std::string
getAbsolutePath(
const std::string& path, std::string base_path);
214 std::filesystem::path base_path_;
215 static std::mutex create_mutex_;
218 void test_filesystem();
223 #endif // SST_CORE_FILESYSTEM_H bool ensureDirectoryExists(std::filesystem::path p, bool strip_filename=false)
This function will ensure a directory exists, and if it doesn't already exist, it will create it...
Definition: filesystem.cc:145
static std::string getRandomName(size_t length=8)
Gets a random file name for use as a temporary file or directory.
Definition: filesystem.cc:266
std::string getAbsolutePath(const std::string &path)
Get the absolute path for a directory or name.
Definition: filesystem.cc:200
FILE * fopen(const std::string &filename, const char *mode)
Open a file using std::fopen().
Definition: filesystem.cc:210
std::string getBasePath() const
Get the base_path set by setBasePath.
Definition: filesystem.h:179
bool setBasePath(const std::string &base_path)
Set the base path to be use when relative paths are used.
Definition: filesystem.cc:103
std::ofstream ofstream(const std::string &filename, std::ios_base::openmode mode=std::ios_base::out)
Open a file using ofstream.
Definition: filesystem.cc:218
std::string createUniqueDirectory(std::filesystem::path dir_name)
Creates a unique directory.
Definition: filesystem.cc:169
Class used to manage files and directories.
Definition: filesystem.h:34