17#ifdef MB_SCRIPTING_ENABLED
65 void createDir(
const std::string &entity_name)
const;
77 void renameDir(
const std::string &old_entity_name,
const std::string &new_entity_name)
const;
84 void deleteDir(
const std::string &entity_name)
const;
97 [[nodiscard]] std::string
dirPath(
const std::string &entity_name,
bool create_if_missing =
false)
const;
110 [[nodiscard]] std::string
filePath(
const std::string &entity_name,
const std::string &filename)
const;
123 std::optional<std::string>
getFilePath(
const std::string &entity_name,
const std::string &filename);
125#ifdef MB_SCRIPTING_ENABLED
126 [[nodiscard]] std::string getFilePathString(
const std::string &entity_name,
127 const std::string &filename);
129 void removeFilesJson(
const std::string &entity_name,
const MbScriptJson &files)
const;
130 [[nodiscard]] std::string canonicalPathString(
const std::string &path)
const;
131 [[nodiscard]]
bool isCanonicalPathString(
const std::string &path)
const;
132 [[nodiscard]] std::string filesBaseDirString()
const;
142 [[nodiscard]]
bool removeFile(
const std::string &entity_name,
const std::string &filename)
const;
150 void removeFiles(
const std::string &entity_name,
const std::vector<std::string> &files)
const;
159 [[nodiscard]]
bool fileExists(
const std::string &entity_name,
const std::string &filename)
const;
MantisBase entry point.
Definition mantisbase.h:54
MbAppMixin(const MantisBase &app)
Constrictor for instantiating this interface.
Definition types.cpp:5
std::optional< std::string > getFilePath(const std::string &entity_name, const std::string &filename)
Get file path only if the file exists.
Definition files.cpp:68
bool fileExists(const std::string &entity_name, const std::string &filename) const
Check if a file exists in an entity's directory.
Definition files.cpp:184
bool removeFile(const std::string &entity_name, const std::string &filename) const
Remove a file from an entity's directory.
Definition files.cpp:159
void removeFiles(const std::string &entity_name, const std::vector< std::string > &files) const
Remove multiple files from an entity's directory.
Definition files.cpp:177
MbFilesMgr(const MantisBase &app)
Definition files.cpp:15
bool isCanonicalPath(const fs::path &path) const
Check if a path is canonical and within the files base directory.
Definition files.cpp:239
fs::path filesBaseDir() const
Get the base directory for all entity files.
Definition files.cpp:282
void renameDir(const std::string &old_entity_name, const std::string &new_entity_name) const
Rename an entity directory.
Definition files.cpp:36
std::string dirPath(const std::string &entity_name, bool create_if_missing=false) const
Get the directory path for an entity.
Definition files.cpp:117
void deleteDir(const std::string &entity_name) const
Delete an entity directory and all its contents.
Definition files.cpp:62
void createDir(const std::string &entity_name) const
Create a directory for the given entity.
Definition files.cpp:19
fs::path getCanonicalPath(const fs::path &path) const
Get canonical path and verify it's within the files base directory.
Definition files.cpp:194
std::string filePath(const std::string &entity_name, const std::string &filename) const
Get the absolute file path for an entity and filename.
Definition files.cpp:143
#define MANTISBASE_API
Definition export.h:31
The main application for mantisbase.
JSON value carried into a Duktape method without going through nlohmann::json.
Definition script_json.h:19
Collection of utility functions that are re-used across different files.