Browse Source

Rename *Dir() functions to *Directory(), backtracking on a previous commit.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
c3ff43b6de
13 changed files with 82 additions and 82 deletions
  1. +1
    -1
      adapters/standalone.cpp
  2. +2
    -2
      include/engine/Module.hpp
  3. +2
    -2
      include/plugin/Model.hpp
  4. +15
    -15
      include/system.hpp
  5. +2
    -2
      src/Window.cpp
  6. +1
    -1
      src/app/MenuBar.cpp
  7. +16
    -16
      src/app/ModuleWidget.cpp
  8. +3
    -3
      src/asset.cpp
  9. +4
    -4
      src/engine/Module.cpp
  10. +9
    -9
      src/patch.cpp
  11. +7
    -7
      src/plugin.cpp
  12. +2
    -2
      src/plugin/Model.cpp
  13. +18
    -18
      src/system.cpp

+ 1
- 1
adapters/standalone.cpp View File

@@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {


// Check existence of the system res/ directory // Check existence of the system res/ directory
std::string resDir = asset::system("res"); std::string resDir = asset::system("res");
if (!system::isDir(resDir)) {
if (!system::isDirectory(resDir)) {
std::string message = string::f("Rack's resource directory \"%s\" does not exist. Make sure Rack is correctly installed and launched.", resDir.c_str()); std::string message = string::f("Rack's resource directory \"%s\" does not exist. Make sure Rack is correctly installed and launched.", resDir.c_str());
osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, message.c_str()); osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, message.c_str());
exit(1); exit(1);


+ 2
- 2
include/engine/Module.hpp View File

@@ -224,8 +224,8 @@ struct Module {
The Module must be added to Engine before this can be called, so it cannot be called in your Module constructor. The Module must be added to Engine before this can be called, so it cannot be called in your Module constructor.
Override onAdd() instead. Override onAdd() instead.
*/ */
std::string createPatchStorageDir();
std::string getPatchStorageDir();
std::string createPatchStorageDirectory();
std::string getPatchStorageDirectory();


struct ProcessArgs { struct ProcessArgs {
/** The current sample rate in Hz. */ /** The current sample rate in Hz. */


+ 2
- 2
include/plugin/Model.hpp View File

@@ -58,8 +58,8 @@ struct Model {
void fromJson(json_t* rootJ); void fromJson(json_t* rootJ);
/** Returns the branded name of the model, e.g. VCV VCO-1. */ /** Returns the branded name of the model, e.g. VCV VCO-1. */
std::string getFullName(); std::string getFullName();
std::string getFactoryPresetDir();
std::string getUserPresetDir();
std::string getFactoryPresetDirectory();
std::string getUserPresetDirectory();
}; };






+ 15
- 15
include/system.hpp View File

@@ -32,7 +32,7 @@ bool exists(const std::string& path);
/** Returns whether the given path is a file. */ /** Returns whether the given path is a file. */
bool isFile(const std::string& path); bool isFile(const std::string& path);
/** Returns whether the given path is a directory. */ /** Returns whether the given path is a directory. */
bool isDir(const std::string& path);
bool isDirectory(const std::string& path);
uint64_t getFileSize(const std::string& path); uint64_t getFileSize(const std::string& path);
/** Moves a file or directory. /** Moves a file or directory.
Does not overwrite the destination. If this behavior is needed, use remove() or removeRecursively() before moving. Does not overwrite the destination. If this behavior is needed, use remove() or removeRecursively() before moving.
@@ -43,10 +43,10 @@ void copy(const std::string& srcPath, const std::string& destPath);
/** Creates a directory. /** Creates a directory.
The parent directory must exist. The parent directory must exist.
*/ */
bool createDir(const std::string& path);
bool createDirectory(const std::string& path);
/** Creates all directories up to the path. /** Creates all directories up to the path.
*/ */
bool createDirs(const std::string& path);
bool createDirectories(const std::string& path);
/** Deletes a file or empty directory. /** Deletes a file or empty directory.
Returns whether the deletion was successful. Returns whether the deletion was successful.
*/ */
@@ -55,9 +55,9 @@ bool remove(const std::string& path);
Returns the number of files and directories that were deleted. Returns the number of files and directories that were deleted.
*/ */
int removeRecursively(const std::string& path); int removeRecursively(const std::string& path);
std::string getWorkingDir();
void setWorkingDir(const std::string& path);
std::string getTempDir();
std::string getWorkingDirectory();
void setWorkingDirectory(const std::string& path);
std::string getTempDirectory();
/** Returns the absolute path beginning with "/". */ /** Returns the absolute path beginning with "/". */
std::string getAbsolute(const std::string& path); std::string getAbsolute(const std::string& path);
/** Returns the canonical (unique) path, following symlinks and "." and ".." fake directories. /** Returns the canonical (unique) path, following symlinks and "." and ".." fake directories.
@@ -68,11 +68,11 @@ Examples:
std::string getCanonical(const std::string& path); std::string getCanonical(const std::string& path);
/** Extracts the parent directory of the path. /** Extracts the parent directory of the path.
Examples: Examples:
getDir("/var/tmp/example.txt") // "/var/tmp"
getDir("/") // ""
getDir("/var/tmp/.") // "/var/tmp"
getDirectory("/var/tmp/example.txt") // "/var/tmp"
getDirectory("/") // ""
getDirectory("/var/tmp/.") // "/var/tmp"
*/ */
std::string getDir(const std::string& path);
std::string getDirectory(const std::string& path);
/** Extracts the filename of the path. /** Extracts the filename of the path.
Examples: Examples:
getFilename("/foo/bar.txt") // "bar.txt" getFilename("/foo/bar.txt") // "bar.txt"
@@ -112,15 +112,15 @@ An equivalent shell command is


ZSTD_CLEVEL=1 tar -cf archivePath --zstd -C dirPath . ZSTD_CLEVEL=1 tar -cf archivePath --zstd -C dirPath .
*/ */
void archiveDir(const std::string& archivePath, const std::string& dirPath, int compressionLevel = 1);
std::vector<uint8_t> archiveDir(const std::string& dirPath, int compressionLevel = 1);
void archiveDirectory(const std::string& archivePath, const std::string& dirPath, int compressionLevel = 1);
std::vector<uint8_t> archiveDirectory(const std::string& dirPath, int compressionLevel = 1);
/** Extracts an archive into a directory. /** Extracts an archive into a directory.
An equivalent shell command is An equivalent shell command is


tar -xf archivePath --zstd -C dirPath tar -xf archivePath --zstd -C dirPath
*/ */
void unarchiveToDir(const std::string& archivePath, const std::string& dirPath);
void unarchiveToDir(const std::vector<uint8_t>& archiveData, const std::string& dirPath);
void unarchiveToDirectory(const std::string& archivePath, const std::string& dirPath);
void unarchiveToDirectory(const std::vector<uint8_t>& archiveData, const std::string& dirPath);




// Threading // Threading
@@ -151,7 +151,7 @@ May block, so open in a new thread.
*/ */
void openBrowser(const std::string& url); void openBrowser(const std::string& url);
/** Opens Windows Explorer, Finder, etc at a directory location. */ /** Opens Windows Explorer, Finder, etc at a directory location. */
void openDir(const std::string& path);
void openDirectory(const std::string& path);
/** Runs an executable without blocking. /** Runs an executable without blocking.
The launched process will continue running if the current process is closed. The launched process will continue running if the current process is closed.
*/ */


+ 2
- 2
src/Window.cpp View File

@@ -530,10 +530,10 @@ void Window::screenshot(const std::string& screenshotPath) {


void Window::screenshotModules(const std::string& screenshotsDir, float zoom) { void Window::screenshotModules(const std::string& screenshotsDir, float zoom) {
// Iterate plugins and create directories // Iterate plugins and create directories
system::createDirs(screenshotsDir);
system::createDirectories(screenshotsDir);
for (plugin::Plugin* p : plugin::plugins) { for (plugin::Plugin* p : plugin::plugins) {
std::string dir = system::join(screenshotsDir, p->slug); std::string dir = system::join(screenshotsDir, p->slug);
system::createDir(dir);
system::createDirectory(dir);
for (plugin::Model* model : p->models) { for (plugin::Model* model : p->models) {
std::string filename = system::join(dir, model->slug + ".png"); std::string filename = system::join(dir, model->slug + ".png");




+ 1
- 1
src/app/MenuBar.cpp View File

@@ -74,7 +74,7 @@ struct DirItem : ui::MenuItem {
std::string path; std::string path;
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
system::openDir(path);
system::openDirectory(path);
}); });
t.detach(); t.detach();
} }


+ 16
- 16
src/app/ModuleWidget.cpp View File

@@ -41,7 +41,7 @@ struct ModuleDirItem : ui::MenuItem {
std::string path; std::string path;
void onAction(const ActionEvent& e) override { void onAction(const ActionEvent& e) override {
std::thread t([=]() { std::thread t([=]() {
system::openDir(path);
system::openDirectory(path);
}); });
t.detach(); t.detach();
} }
@@ -288,14 +288,14 @@ struct ModulePresetDirItem : ui::MenuItem {
static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) { static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) {
bool hasPresets = false; bool hasPresets = false;
// Note: This is not cached, so opening this menu each time might have a bit of latency. // Note: This is not cached, so opening this menu each time might have a bit of latency.
if (system::isDir(presetDir)) {
if (system::isDirectory(presetDir)) {
for (const std::string& path : system::getEntries(presetDir)) { for (const std::string& path : system::getEntries(presetDir)) {
std::string name = system::getStem(path); std::string name = system::getStem(path);
// Remove "1_", "42_", "001_", etc at the beginning of preset filenames // Remove "1_", "42_", "001_", etc at the beginning of preset filenames
std::regex r("^\\d*_"); std::regex r("^\\d*_");
name = std::regex_replace(name, r, ""); name = std::regex_replace(name, r, "");


if (system::isDir(path)) {
if (system::isDirectory(path)) {
hasPresets = true; hasPresets = true;


ModulePresetDirItem* dirItem = new ModulePresetDirItem; ModulePresetDirItem* dirItem = new ModulePresetDirItem;
@@ -365,12 +365,12 @@ struct ModulePresetItem : ui::MenuItem {
// Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets. // Scan `<user dir>/presets/<plugin slug>/<module slug>` for presets.
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
menu->addChild(createMenuLabel("User presets")); menu->addChild(createMenuLabel("User presets"));
appendPresetItems(menu, moduleWidget, moduleWidget->model->getUserPresetDir());
appendPresetItems(menu, moduleWidget, moduleWidget->model->getUserPresetDirectory());


// Scan `<plugin dir>/presets/<module slug>` for presets. // Scan `<plugin dir>/presets/<module slug>` for presets.
menu->addChild(new ui::MenuSeparator); menu->addChild(new ui::MenuSeparator);
menu->addChild(createMenuLabel("Factory presets")); menu->addChild(createMenuLabel("Factory presets"));
appendPresetItems(menu, moduleWidget, moduleWidget->model->getFactoryPresetDir());
appendPresetItems(menu, moduleWidget, moduleWidget->model->getFactoryPresetDirectory());


return menu; return menu;
} }
@@ -836,7 +836,7 @@ void ModuleWidget::loadAction(std::string filename) {
} }


void ModuleWidget::loadTemplate() { void ModuleWidget::loadTemplate() {
std::string templatePath = system::join(model->getUserPresetDir(), "template.vcvm");
std::string templatePath = system::join(model->getUserPresetDirectory(), "template.vcvm");
try { try {
load(templatePath); load(templatePath);
} }
@@ -846,14 +846,14 @@ void ModuleWidget::loadTemplate() {
} }


void ModuleWidget::loadDialog() { void ModuleWidget::loadDialog() {
std::string presetDir = model->getUserPresetDir();
system::createDirs(presetDir);
std::string presetDir = model->getUserPresetDirectory();
system::createDirectories(presetDir);


// Delete directories if empty // Delete directories if empty
DEFER({ DEFER({
try { try {
system::remove(presetDir); system::remove(presetDir);
system::remove(system::getDir(presetDir));
system::remove(system::getDirectory(presetDir));
} }
catch (Exception& e) { catch (Exception& e) {
// Ignore exceptions if directory cannot be removed. // Ignore exceptions if directory cannot be removed.
@@ -897,8 +897,8 @@ void ModuleWidget::save(std::string filename) {
} }


void ModuleWidget::saveTemplate() { void ModuleWidget::saveTemplate() {
std::string presetDir = model->getUserPresetDir();
system::createDirs(presetDir);
std::string presetDir = model->getUserPresetDirectory();
system::createDirectories(presetDir);
std::string templatePath = system::join(presetDir, "template.vcvm"); std::string templatePath = system::join(presetDir, "template.vcvm");
save(templatePath); save(templatePath);
} }
@@ -913,13 +913,13 @@ void ModuleWidget::saveTemplateDialog() {
} }


bool ModuleWidget::hasTemplate() { bool ModuleWidget::hasTemplate() {
std::string presetDir = model->getUserPresetDir();
std::string presetDir = model->getUserPresetDirectory();
std::string templatePath = system::join(presetDir, "template.vcvm"); std::string templatePath = system::join(presetDir, "template.vcvm");
return system::exists(templatePath);; return system::exists(templatePath);;
} }


void ModuleWidget::clearTemplate() { void ModuleWidget::clearTemplate() {
std::string presetDir = model->getUserPresetDir();
std::string presetDir = model->getUserPresetDirectory();
std::string templatePath = system::join(presetDir, "template.vcvm"); std::string templatePath = system::join(presetDir, "template.vcvm");
system::remove(templatePath); system::remove(templatePath);
} }
@@ -932,14 +932,14 @@ void ModuleWidget::clearTemplateDialog() {
} }


void ModuleWidget::saveDialog() { void ModuleWidget::saveDialog() {
std::string presetDir = model->getUserPresetDir();
system::createDirs(presetDir);
std::string presetDir = model->getUserPresetDirectory();
system::createDirectories(presetDir);


// Delete directories if empty // Delete directories if empty
DEFER({ DEFER({
try { try {
system::remove(presetDir); system::remove(presetDir);
system::remove(system::getDir(presetDir));
system::remove(system::getDirectory(presetDir));
} }
catch (Exception& e) { catch (Exception& e) {
// Ignore exceptions if directory cannot be removed. // Ignore exceptions if directory cannot be removed.


+ 3
- 3
src/asset.cpp View File

@@ -34,7 +34,7 @@ static void initSystemDir() {
return; return;


if (settings::devMode) { if (settings::devMode) {
systemDir = system::getWorkingDir();
systemDir = system::getWorkingDirectory();
return; return;
} }


@@ -71,7 +71,7 @@ static void initSystemDir() {
#endif #endif
#if defined ARCH_LIN #if defined ARCH_LIN
// Use the current working directory as the default path on Linux. // Use the current working directory as the default path on Linux.
systemDir = system::getWorkingDir();
systemDir = system::getWorkingDirectory();
#endif #endif
} }


@@ -114,7 +114,7 @@ void init() {
initSystemDir(); initSystemDir();
initUserDir(); initUserDir();


system::createDir(userDir);
system::createDirectory(userDir);
} }






+ 4
- 4
src/engine/Module.cpp View File

@@ -82,14 +82,14 @@ void Module::config(int numParams, int numInputs, int numOutputs, int numLights)
} }




std::string Module::createPatchStorageDir() {
std::string path = getPatchStorageDir();
system::createDirs(path);
std::string Module::createPatchStorageDirectory() {
std::string path = getPatchStorageDirectory();
system::createDirectories(path);
return path; return path;
} }




std::string Module::getPatchStorageDir() {
std::string Module::getPatchStorageDirectory() {
return system::join(APP->patch->autosavePath, "modules", std::to_string(id)); return system::join(APP->patch->autosavePath, "modules", std::to_string(id));
} }




+ 9
- 9
src/patch.cpp View File

@@ -99,7 +99,7 @@ void PatchManager::save(std::string path) {


double startTime = system::getTime(); double startTime = system::getTime();
// Set compression level to 1 so that a 500MB/s SSD is almost bottlenecked // Set compression level to 1 so that a 500MB/s SSD is almost bottlenecked
system::archiveDir(path, autosavePath, 1);
system::archiveDirectory(path, autosavePath, 1);
double endTime = system::getTime(); double endTime = system::getTime();
INFO("Archived patch in %lf seconds", (endTime - startTime)); INFO("Archived patch in %lf seconds", (endTime - startTime));
} }
@@ -130,11 +130,11 @@ void PatchManager::saveAsDialog() {
std::string filename; std::string filename;
if (this->path == "") { if (this->path == "") {
dir = asset::user("patches"); dir = asset::user("patches");
system::createDirs(dir);
system::createDirectories(dir);
filename = "Untitled.vcv"; filename = "Untitled.vcv";
} }
else { else {
dir = system::getDir(this->path);
dir = system::getDirectory(this->path);
filename = system::getFilename(this->path); filename = system::getFilename(this->path);
} }


@@ -195,7 +195,7 @@ void PatchManager::saveAutosave() {
DEFER({json_decref(rootJ);}); DEFER({json_decref(rootJ);});


// Write to temporary path and then rename it to the correct path // Write to temporary path and then rename it to the correct path
system::createDirs(autosavePath);
system::createDirectories(autosavePath);
std::string tmpPath = patchPath + ".tmp"; std::string tmpPath = patchPath + ".tmp";
FILE* file = std::fopen(tmpPath.c_str(), "w"); FILE* file = std::fopen(tmpPath.c_str(), "w");
if (!file) { if (!file) {
@@ -213,7 +213,7 @@ void PatchManager::saveAutosave() {
void PatchManager::cleanAutosave() { void PatchManager::cleanAutosave() {
// Remove files and directories in the `autosave/modules` directory that doesn't match a module in the rack. // Remove files and directories in the `autosave/modules` directory that doesn't match a module in the rack.
std::string modulesDir = system::join(autosavePath, "modules"); std::string modulesDir = system::join(autosavePath, "modules");
if (system::isDir(modulesDir)) {
if (system::isDirectory(modulesDir)) {
for (const std::string& entry : system::getEntries(modulesDir)) { for (const std::string& entry : system::getEntries(modulesDir)) {
try { try {
int64_t moduleId = std::stol(system::getFilename(entry)); int64_t moduleId = std::stol(system::getFilename(entry));
@@ -248,7 +248,7 @@ void PatchManager::load(std::string path) {
INFO("Loading patch %s", path.c_str()); INFO("Loading patch %s", path.c_str());


system::removeRecursively(autosavePath); system::removeRecursively(autosavePath);
system::createDirs(autosavePath);
system::createDirectories(autosavePath);


if (isPatchLegacyV1(path)) { if (isPatchLegacyV1(path)) {
// Copy the .vcv file directly to "patch.json". // Copy the .vcv file directly to "patch.json".
@@ -257,7 +257,7 @@ void PatchManager::load(std::string path) {
else { else {
// Extract the .vcv file as a .tar.zst archive. // Extract the .vcv file as a .tar.zst archive.
double startTime = system::getTime(); double startTime = system::getTime();
system::unarchiveToDir(path, autosavePath);
system::unarchiveToDirectory(path, autosavePath);
double endTime = system::getTime(); double endTime = system::getTime();
INFO("Unarchived patch in %lf seconds", (endTime - startTime)); INFO("Unarchived patch in %lf seconds", (endTime - startTime));
} }
@@ -348,10 +348,10 @@ void PatchManager::loadDialog() {
std::string dir; std::string dir;
if (this->path == "") { if (this->path == "") {
dir = asset::user("patches"); dir = asset::user("patches");
system::createDir(dir);
system::createDirectory(dir);
} }
else { else {
dir = system::getDir(this->path);
dir = system::getDirectory(this->path);
} }


osdialog_filters* filters = osdialog_filters_parse(PATCH_FILTERS); osdialog_filters* filters = osdialog_filters_parse(PATCH_FILTERS);


+ 7
- 7
src/plugin.cpp View File

@@ -53,10 +53,10 @@ static void* loadLibrary(std::string libraryPath) {
} }
#else #else
// As of Rack v2.0, plugins are linked with `-rpath=.` so change current directory so it can find libRack. // As of Rack v2.0, plugins are linked with `-rpath=.` so change current directory so it can find libRack.
std::string cwd = system::getWorkingDir();
system::setWorkingDir(asset::systemDir);
std::string cwd = system::getWorkingDirectory();
system::setWorkingDirectory(asset::systemDir);
// Change it back when we're finished // Change it back when we're finished
DEFER({system::setWorkingDir(cwd);});
DEFER({system::setWorkingDirectory(cwd);});
// Load library with dlopen // Load library with dlopen
void* handle = dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_LOCAL); void* handle = dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
if (!handle) if (!handle)
@@ -166,7 +166,7 @@ static Plugin* loadPlugin(std::string path) {


static void loadPlugins(std::string path) { static void loadPlugins(std::string path) {
for (std::string pluginPath : system::getEntries(path)) { for (std::string pluginPath : system::getEntries(path)) {
if (!system::isDir(pluginPath))
if (!system::isDirectory(pluginPath))
continue; continue;
if (!loadPlugin(pluginPath)) { if (!loadPlugin(pluginPath)) {
// Ignore bad plugins. They are reported in the log. // Ignore bad plugins. They are reported in the log.
@@ -187,7 +187,7 @@ static void extractPackages(std::string path) {
// Extract package // Extract package
INFO("Extracting package %s", packagePath.c_str()); INFO("Extracting package %s", packagePath.c_str());
try { try {
system::unarchiveToDir(packagePath, path);
system::unarchiveToDirectory(packagePath, path);
} }
catch (Exception& e) { catch (Exception& e) {
WARN("Plugin package %s failed to extract: %s", packagePath.c_str(), e.what()); WARN("Plugin package %s failed to extract: %s", packagePath.c_str(), e.what());
@@ -221,7 +221,7 @@ void init() {
} }


// Get user plugins directory // Get user plugins directory
system::createDir(pluginsPath);
system::createDirectory(pluginsPath);


// Extract packages and load plugins // Extract packages and load plugins
extractPackages(pluginsPath); extractPackages(pluginsPath);
@@ -232,7 +232,7 @@ void init() {
std::string fundamentalDir = system::join(pluginsPath, "Fundamental"); std::string fundamentalDir = system::join(pluginsPath, "Fundamental");
if (!settings::devMode && !getPlugin("Fundamental") && system::isFile(fundamentalSrc)) { if (!settings::devMode && !getPlugin("Fundamental") && system::isFile(fundamentalSrc)) {
INFO("Extracting bundled Fundamental package"); INFO("Extracting bundled Fundamental package");
system::unarchiveToDir(fundamentalSrc.c_str(), pluginsPath.c_str());
system::unarchiveToDirectory(fundamentalSrc.c_str(), pluginsPath.c_str());
loadPlugin(fundamentalDir); loadPlugin(fundamentalDir);
} }
} }


+ 2
- 2
src/plugin/Model.cpp View File

@@ -63,12 +63,12 @@ std::string Model::getFullName() {
} }




std::string Model::getFactoryPresetDir() {
std::string Model::getFactoryPresetDirectory() {
return asset::plugin(plugin, system::join("presets", slug)); return asset::plugin(plugin, system::join("presets", slug));
} }




std::string Model::getUserPresetDir() {
std::string Model::getUserPresetDirectory() {
return asset::user(system::join("presets", plugin->slug, slug)); return asset::user(system::join("presets", plugin->slug, slug));
} }




+ 18
- 18
src/system.cpp View File

@@ -100,7 +100,7 @@ bool isFile(const std::string& path) {
} }




bool isDir(const std::string& path) {
bool isDirectory(const std::string& path) {
try { try {
return fs::is_directory(fs::u8path(path)); return fs::is_directory(fs::u8path(path));
} }
@@ -140,7 +140,7 @@ void copy(const std::string& srcPath, const std::string& destPath) {
} }




bool createDir(const std::string& path) {
bool createDirectory(const std::string& path) {
try { try {
return fs::create_directory(fs::u8path(path)); return fs::create_directory(fs::u8path(path));
} }
@@ -150,7 +150,7 @@ bool createDir(const std::string& path) {
} }




bool createDirs(const std::string& path) {
bool createDirectories(const std::string& path) {
try { try {
return fs::create_directories(fs::u8path(path)); return fs::create_directories(fs::u8path(path));
} }
@@ -180,7 +180,7 @@ int removeRecursively(const std::string& path) {
} }




std::string getWorkingDir() {
std::string getWorkingDirectory() {
try { try {
return fs::current_path().generic_u8string(); return fs::current_path().generic_u8string();
} }
@@ -190,7 +190,7 @@ std::string getWorkingDir() {
} }




void setWorkingDir(const std::string& path) {
void setWorkingDirectory(const std::string& path) {
try { try {
fs::current_path(fs::u8path(path)); fs::current_path(fs::u8path(path));
} }
@@ -200,7 +200,7 @@ void setWorkingDir(const std::string& path) {
} }




std::string getTempDir() {
std::string getTempDirectory() {
try { try {
return fs::temp_directory_path().generic_u8string(); return fs::temp_directory_path().generic_u8string();
} }
@@ -230,7 +230,7 @@ std::string getCanonical(const std::string& path) {
} }




std::string getDir(const std::string& path) {
std::string getDirectory(const std::string& path) {
try { try {
return fs::u8path(path).parent_path().generic_u8string(); return fs::u8path(path).parent_path().generic_u8string();
} }
@@ -300,7 +300,7 @@ static la_ssize_t archiveWriteVectorCallback(struct archive* a, void* client_dat
} }




static void archiveDir(const std::string& archivePath, std::vector<uint8_t>* archiveData, const std::string& dirPath, int compressionLevel) {
static void archiveDirectory(const std::string& archivePath, std::vector<uint8_t>* archiveData, const std::string& dirPath, int compressionLevel) {
// Based on minitar.c create() in libarchive examples // Based on minitar.c create() in libarchive examples
int r; int r;


@@ -394,13 +394,13 @@ static void archiveDir(const std::string& archivePath, std::vector<uint8_t>* arc
} }
} }


void archiveDir(const std::string& archivePath, const std::string& dirPath, int compressionLevel) {
archiveDir(archivePath, NULL, dirPath, compressionLevel);
void archiveDirectory(const std::string& archivePath, const std::string& dirPath, int compressionLevel) {
archiveDirectory(archivePath, NULL, dirPath, compressionLevel);
} }


std::vector<uint8_t> archiveDir(const std::string& dirPath, int compressionLevel) {
std::vector<uint8_t> archiveDirectory(const std::string& dirPath, int compressionLevel) {
std::vector<uint8_t> archiveData; std::vector<uint8_t> archiveData;
archiveDir("", &archiveData, dirPath, compressionLevel);
archiveDirectory("", &archiveData, dirPath, compressionLevel);
return archiveData; return archiveData;
} }


@@ -422,7 +422,7 @@ static la_ssize_t archiveReadVectorCallback(struct archive *a, void* client_data
return len; return len;
} }


static void unarchiveToDir(const std::string& archivePath, const std::vector<uint8_t>* archiveData, const std::string& dirPath) {
static void unarchiveToDirectory(const std::string& archivePath, const std::vector<uint8_t>* archiveData, const std::string& dirPath) {
// Based on minitar.c extract() in libarchive examples // Based on minitar.c extract() in libarchive examples
int r; int r;


@@ -510,12 +510,12 @@ static void unarchiveToDir(const std::string& archivePath, const std::vector<uin
} }
} }


void unarchiveToDir(const std::string& archivePath, const std::string& dirPath) {
unarchiveToDir(archivePath, NULL, dirPath);
void unarchiveToDirectory(const std::string& archivePath, const std::string& dirPath) {
unarchiveToDirectory(archivePath, NULL, dirPath);
} }


void unarchiveToDir(const std::vector<uint8_t>& archiveData, const std::string& dirPath) {
unarchiveToDir("", &archiveData, dirPath);
void unarchiveToDirectory(const std::vector<uint8_t>& archiveData, const std::string& dirPath) {
unarchiveToDirectory("", &archiveData, dirPath);
} }




@@ -689,7 +689,7 @@ void openBrowser(const std::string& url) {
} }




void openDir(const std::string& path) {
void openDirectory(const std::string& path) {
#if defined ARCH_LIN #if defined ARCH_LIN
std::string command = "xdg-open \"" + path + "\""; std::string command = "xdg-open \"" + path + "\"";
(void) std::system(command.c_str()); (void) std::system(command.c_str());


Loading…
Cancel
Save