Browse Source

Use "directory/dir" terminology instead of "folder" except for UI text.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
00eb16189b
14 changed files with 109 additions and 101 deletions
  1. +1
    -1
      adapters/standalone.cpp
  2. +2
    -2
      include/asset.hpp
  3. +5
    -2
      include/engine/Module.hpp
  4. +1
    -1
      include/patch.hpp
  5. +1
    -1
      include/plugin.hpp
  6. +25
    -25
      include/system.hpp
  7. +7
    -6
      src/app/MenuBar.cpp
  8. +15
    -11
      src/app/ModuleWidget.cpp
  9. +5
    -5
      src/asset.cpp
  10. +1
    -1
      src/engine/Module.cpp
  11. +10
    -10
      src/patch.cpp
  12. +7
    -7
      src/plugin.cpp
  13. +27
    -27
      src/system.cpp
  14. +2
    -2
      src/window.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
std::string resDir = asset::system("res");
if (!system::isDirectory(resDir)) {
if (!system::isDir(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());
osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, message.c_str());
exit(1);


+ 2
- 2
include/asset.hpp View File

@@ -26,10 +26,10 @@ std::string system(std::string filename = "");
/** Returns the path of a user asset. Can read and write files to this location. */
std::string user(std::string filename = "");

/** Returns the path of a asset in the plugin's folder.
/** Returns the path of a asset in the plugin's dir.
Plugin assets should be read-only by plugins.
Examples:
asset::plugin(pluginInstance, "samples/00.wav") // "/path/to/Rack/user/folder/plugins/MyPlugin/samples/00.wav"
asset::plugin(pluginInstance, "samples/00.wav") // "/path/to/Rack/user/dir/plugins/MyPlugin/samples/00.wav"
*/
std::string plugin(plugin::Plugin* plugin, std::string filename = "");



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

@@ -218,8 +218,11 @@ struct Module {
bypassRoutes.push_back(br);
}

/** Creates and returns the module's patch storage folder path.
Since the folder is created when this is called, do not call it frequently or in an audio/engine thread such as process().
/** Creates and returns the module's patch storage directory path.
Since the directory is created when this is called, do not call it frequently or in an audio/engine thread such as process().

The Module must be added to Engine before this can be called, so it cannot be called in your Module constructor.
Override onAdd() instead.
*/
std::string createPatchStorageDir();
std::string getPatchStorageDir();


+ 1
- 1
include/patch.hpp View File

@@ -13,7 +13,7 @@ struct PatchManager {

/** The currently loaded patch file path */
std::string path;
/** Path to autosave folder */
/** Path to autosave dir */
std::string autosavePath;
/** Path to user template patch */
std::string templatePath;


+ 1
- 1
include/plugin.hpp View File

@@ -28,7 +28,7 @@ bool isSlugValid(const std::string& slug);
std::string normalizeSlug(const std::string& slug);


/** Path to plugins installation folder */
/** Path to plugins installation dir */
extern std::string pluginsPath;
extern std::vector<Plugin*> plugins;



+ 25
- 25
include/system.hpp View File

@@ -32,21 +32,21 @@ bool exists(const std::string& path);
/** Returns whether the given path is a file. */
bool isFile(const std::string& path);
/** Returns whether the given path is a directory. */
bool isDirectory(const std::string& path);
bool isDir(const std::string& path);
uint64_t getFileSize(const std::string& path);
/** Moves a file or folder.
/** Moves a file or directory.
Does not overwrite the destination. If this behavior is needed, use remove() or removeRecursively() before moving.
*/
void rename(const std::string& srcPath, const std::string& destPath);
/** Copies a file or folder recursively. */
/** Copies a file or directory recursively. */
void copy(const std::string& srcPath, const std::string& destPath);
/** Creates a directory.
The parent directory must exist.
*/
bool createDirectory(const std::string& path);
bool createDir(const std::string& path);
/** Creates all directories up to the path.
*/
bool createDirectories(const std::string& path);
bool createDirs(const std::string& path);
/** Deletes a file or empty directory.
Returns whether the deletion was successful.
*/
@@ -55,8 +55,8 @@ bool remove(const std::string& path);
Returns the number of files and directories that were deleted.
*/
int removeRecursively(const std::string& path);
std::string getWorkingDirectory();
void setWorkingDirectory(const std::string& path);
std::string getWorkingDir();
void setWorkingDir(const std::string& path);
std::string getTempDir();
/** Returns the absolute path beginning with "/". */
std::string getAbsolute(const std::string& path);
@@ -68,11 +68,11 @@ Examples:
std::string getCanonical(const std::string& path);
/** Extracts the parent directory of the path.
Examples:
getDirectory("/var/tmp/example.txt") // "/var/tmp"
getDirectory("/") // ""
getDirectory("/var/tmp/.") // "/var/tmp"
getDir("/var/tmp/example.txt") // "/var/tmp"
getDir("/") // ""
getDir("/var/tmp/.") // "/var/tmp"
*/
std::string getDirectory(const std::string& path);
std::string getDir(const std::string& path);
/** Extracts the filename of the path.
Examples:
getFilename("/foo/bar.txt") // "bar.txt"
@@ -87,9 +87,9 @@ Examples:
std::string getFilename(const std::string& path);
/** Extracts the portion of a filename without the extension.
Examples:
getExtension("/foo/bar.txt") // "bar"
getExtension("/foo/.bar") // ""
getExtension("/foo/foo.bar.baz.tar") // "foo.bar.baz"
getStem("/foo/bar.txt") // "bar"
getStem("/foo/.bar") // ""
getStem("/foo/foo.tar.ztd") // "foo.tar"
*/
std::string getStem(const std::string& path);
/** Extracts the extension of a filename, including the dot.
@@ -106,21 +106,21 @@ Examples:
*/
std::string getExtension(const std::string& path);

/** Compresses the contents of a folder (recursively) to an archive.
/** Compresses the contents of a directory (recursively) to an archive.
Uses the Unix Standard TAR + Zstandard format (.tar.zst).
An equivalent shell command is

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

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


// Threading
@@ -145,13 +145,13 @@ std::string getOperatingSystemInfo();

// Applications

/** Opens a URL, also happens to work with PDFs and folders.
/** Opens a URL in a browser.
Shell injection is possible, so make sure the URL is trusted or hard coded.
May block, so open in a new thread.
*/
void openBrowser(const std::string& url);
/** Opens Windows Explorer, Finder, etc at the folder location. */
void openFolder(const std::string& path);
/** Opens Windows Explorer, Finder, etc at a directory location. */
void openDir(const std::string& path);
/** Runs an executable without blocking.
The launched process will continue running if the current process is closed.
*/


+ 7
- 6
src/app/MenuBar.cpp View File

@@ -70,11 +70,11 @@ struct UrlItem : ui::MenuItem {
}
};

struct FolderItem : ui::MenuItem {
struct DirItem : ui::MenuItem {
std::string path;
void onAction(const ActionEvent& e) override {
std::thread t([=] {
system::openFolder(path);
system::openDir(path);
});
t.detach();
}
@@ -1041,14 +1041,15 @@ struct HelpButton : MenuButton {
menu->addChild(checkAppUpdateItem);
}

FolderItem* folderItem = new FolderItem;
folderItem->text = "Open user folder";
folderItem->path = asset::user("");
menu->addChild(folderItem);
DirItem* dirItem = new DirItem;
dirItem->text = "Open user folder";
dirItem->path = asset::user("");
menu->addChild(dirItem);

menu->addChild(new ui::MenuSeparator);

menu->addChild(createMenuLabel(APP_VARIANT));

menu->addChild(createMenuLabel(APP_VERSION));
}



+ 15
- 11
src/app/ModuleWidget.cpp View File

@@ -29,16 +29,20 @@ static const char PRESET_FILTERS[] = "VCV Rack module preset (.vcvm):vcvm";
struct ModuleUrlItem : ui::MenuItem {
std::string url;
void onAction(const ActionEvent& e) override {
std::thread t(system::openBrowser, url);
std::thread t([=]() {
system::openBrowser(url);
});
t.detach();
}
};


struct ModuleFolderItem : ui::MenuItem {
struct ModuleDirItem : ui::MenuItem {
std::string path;
void onAction(const ActionEvent& e) override {
std::thread t(system::openFolder, path);
std::thread t([=]() {
system::openDir(path);
});
t.detach();
}
};
@@ -147,7 +151,7 @@ struct ModuleInfoItem : ui::MenuItem {

// plugin folder
if (model->plugin->path != "") {
ModuleFolderItem* pathItem = new ModuleFolderItem;
ModuleDirItem* pathItem = new ModuleDirItem;
pathItem->text = "Open plugin folder";
pathItem->path = model->plugin->path;
menu->addChild(pathItem);
@@ -284,14 +288,14 @@ struct ModulePresetDirItem : ui::MenuItem {
static void appendPresetItems(ui::Menu* menu, WeakPtr<ModuleWidget> moduleWidget, std::string presetDir) {
bool hasPresets = false;
// Note: This is not cached, so opening this menu each time might have a bit of latency.
if (system::isDirectory(presetDir)) {
if (system::isDir(presetDir)) {
for (const std::string& path : system::getEntries(presetDir)) {
std::string name = system::getStem(path);
// Remove "1_", "42_", "001_", etc at the beginning of preset filenames
std::regex r("^\\d*_");
name = std::regex_replace(name, r, "");

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

ModulePresetDirItem* dirItem = new ModulePresetDirItem;
@@ -843,13 +847,13 @@ void ModuleWidget::loadTemplate() {

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

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

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

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

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


+ 5
- 5
src/asset.cpp View File

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

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

@@ -65,13 +65,13 @@ static void initSystemDir() {
wchar_t moduleBufW[MAX_PATH] = L"";
DWORD length = GetModuleFileNameW(NULL, moduleBufW, LENGTHOF(moduleBufW));
assert(length > 0);
// Get folder of executable
// Get directory of executable
PathRemoveFileSpecW(moduleBufW);
systemDir = string::UTF16toUTF8(moduleBufW);
#endif
#if defined ARCH_LIN
// Use the current working directory as the default path on Linux.
systemDir = system::getWorkingDirectory();
systemDir = system::getWorkingDir();
#endif
}

@@ -86,7 +86,7 @@ static void initUserDir() {
}

#if defined ARCH_WIN
// Get "My Documents" folder
// Get "My Documents" path
wchar_t documentsBufW[MAX_PATH] = L".";
HRESULT result = SHGetFolderPathW(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBufW);
assert(result == S_OK);
@@ -114,7 +114,7 @@ void init() {
initSystemDir();
initUserDir();

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




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

@@ -84,7 +84,7 @@ void Module::config(int numParams, int numInputs, int numOutputs, int numLights)

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



+ 10
- 10
src/patch.cpp View File

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

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

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

// Write to temporary path and then rename it to the correct path
system::createDirectories(autosavePath);
system::createDirs(autosavePath);
std::string tmpPath = patchPath + ".tmp";
FILE* file = std::fopen(tmpPath.c_str(), "w");
if (!file) {
@@ -212,9 +212,9 @@ void PatchManager::saveAutosave() {


void PatchManager::cleanAutosave() {
// Remove files and folders in the `autosave/modules` folder 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");
if (system::isDirectory(modulesDir)) {
if (system::isDir(modulesDir)) {
for (const std::string& entry : system::getEntries(modulesDir)) {
try {
int64_t moduleId = std::stol(system::getFilename(entry));
@@ -249,7 +249,7 @@ void PatchManager::load(std::string path) {
INFO("Loading patch %s", path.c_str());

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

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

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

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

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

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


+ 27
- 27
src/system.cpp View File

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


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


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


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


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


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


std::string getDirectory(const std::string& path) {
std::string getDir(const std::string& path) {
try {
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 archiveFolder(const std::string& archivePath, std::vector<uint8_t>* archiveData, const std::string& folderPath, int compressionLevel) {
static void archiveDir(const std::string& archivePath, std::vector<uint8_t>* archiveData, const std::string& dirPath, int compressionLevel) {
// Based on minitar.c create() in libarchive examples
int r;

@@ -330,19 +330,19 @@ static void archiveFolder(const std::string& archivePath, std::vector<uint8_t>*
}
DEFER({archive_write_close(a);});

// Open folder for reading
// Open dir for reading
struct archive* disk = archive_read_disk_new();
DEFER({archive_read_free(disk);});
#if defined ARCH_WIN
r = archive_read_disk_open_w(disk, string::UTF8toUTF16(folderPath).c_str());
r = archive_read_disk_open_w(disk, string::UTF8toUTF16(dirPath).c_str());
#else
r = archive_read_disk_open(disk, folderPath.c_str());
r = archive_read_disk_open(disk, dirPath.c_str());
#endif
if (r < ARCHIVE_OK)
throw Exception("Archiver could not open folder %s for reading: %s", folderPath.c_str(), archive_error_string(a));
throw Exception("Archiver could not open dir %s for reading: %s", dirPath.c_str(), archive_error_string(a));
DEFER({archive_read_close(a);});

// Iterate folder
// Iterate dir
for (;;) {
struct archive_entry* entry = archive_entry_new();
DEFER({archive_entry_free(entry);});
@@ -363,7 +363,7 @@ static void archiveFolder(const std::string& archivePath, std::vector<uint8_t>*
#else
entryPath = archive_entry_pathname(entry);
#endif
entryPath = getRelativePath(entryPath, folderPath);
entryPath = getRelativePath(entryPath, dirPath);
#if defined ARCH_WIN
// FIXME This doesn't seem to set UTF-8 paths on Windows.
archive_entry_copy_pathname_w(entry, string::UTF8toUTF16(entryPath).c_str());
@@ -392,13 +392,13 @@ static void archiveFolder(const std::string& archivePath, std::vector<uint8_t>*
}
}

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

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

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

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

@@ -450,7 +450,7 @@ static void unarchiveToFolder(const std::string& archivePath, const std::vector<
}
DEFER({archive_read_close(a);});

// Open folder for writing
// Open dir for writing
struct archive* disk = archive_write_disk_new();
DEFER({archive_write_free(disk);});
int flags = ARCHIVE_EXTRACT_TIME;
@@ -467,11 +467,11 @@ static void unarchiveToFolder(const std::string& archivePath, const std::vector<
if (r < ARCHIVE_OK)
throw Exception("Unarchiver could not read entry from archive: %s", archive_error_string(a));

// Convert relative pathname to absolute based on folderPath
// Convert relative pathname to absolute based on dirPath
std::string entryPath = archive_entry_pathname(entry);
if (!fs::u8path(entryPath).is_relative())
throw Exception("Unarchiver does not support absolute tar paths: %s", entryPath.c_str());
entryPath = (fs::u8path(folderPath) / fs::u8path(entryPath)).generic_u8string();
entryPath = (fs::u8path(dirPath) / fs::u8path(entryPath)).generic_u8string();
#if defined ARCH_WIN
archive_entry_copy_pathname_w(entry, string::UTF8toUTF16(entryPath).c_str());
#else
@@ -481,7 +481,7 @@ static void unarchiveToFolder(const std::string& archivePath, const std::vector<
// Write entry to disk
r = archive_write_header(disk, entry);
if (r < ARCHIVE_OK)
throw Exception("Unarchiver could not write file to folder: %s", archive_error_string(disk));
throw Exception("Unarchiver could not write file to dir: %s", archive_error_string(disk));

// Copy data to file
for (;;) {
@@ -508,12 +508,12 @@ static void unarchiveToFolder(const std::string& archivePath, const std::vector<
}
}

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

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


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


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


+ 2
- 2
src/window.cpp View File

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

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



Loading…
Cancel
Save