Browse Source

Merge branch 'v2' of github.com:VCVRack/Rack-private into v2

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
d0c2165fd0
2 changed files with 13 additions and 2 deletions
  1. +6
    -0
      src/patch.cpp
  2. +7
    -2
      src/system.cpp

+ 6
- 0
src/patch.cpp View File

@@ -62,7 +62,10 @@ void PatchManager::save(std::string path) {
INFO("Saving patch %s", path.c_str());
saveAutosave();

uint64_t startTime = system::getNanoseconds();
system::archiveFolder(path, asset::autosavePath);
uint64_t endTime = system::getNanoseconds();
INFO("Archived patch in %lf seconds", (endTime - startTime) / 1e9);
}


@@ -190,7 +193,10 @@ void PatchManager::load(std::string path) {
}
else {
// Extract the .vcv file as a .tar.zst archive.
uint64_t startTime = system::getNanoseconds();
system::unarchiveToFolder(path, asset::autosavePath);
uint64_t endTime = system::getNanoseconds();
INFO("Unarchived patch in %lf seconds", (endTime - startTime) / 1e9);
}

loadAutosave();


+ 7
- 2
src/system.cpp View File

@@ -292,6 +292,11 @@ void archiveFolder(const std::string& archivePath, const std::string& folderPath
DEFER({archive_write_free(a);});
archive_write_set_format_ustar(a);
archive_write_add_filter_zstd(a);
// Set compression level roughly so that a 500MB/s SSD is bottlenecked
r = archive_write_set_filter_option(a, NULL, "compression-level", "1");
if (r < ARCHIVE_OK)
throw Exception(string::f("archiveFolder() could not set filter option: %s", archive_error_string(a)));

#if defined ARCH_WIN
r = archive_write_open_filename_w(a, string::U8toU16(archivePath).c_str());
#else
@@ -355,7 +360,7 @@ void archiveFolder(const std::string& archivePath, const std::string& folderPath
#endif
FILE* f = std::fopen(entrySourcePath.c_str(), "rb");
DEFER({std::fclose(f);});
char buf[1 << 14];
char buf[1 << 16];
ssize_t len;
while ((len = std::fread(buf, 1, sizeof(buf), f)) > 0) {
archive_write_data(a, buf, len);
@@ -376,7 +381,7 @@ void unarchiveToFolder(const std::string& archivePath, const std::string& folder
archive_read_support_format_tar(a);
// archive_read_support_format_all(a);
#if defined ARCH_WIN
r = archive_read_open_filename_w(a, string::U8toU16(archivePath).c_str(), 1 << 14);
r = archive_read_open_filename_w(a, string::U8toU16(archivePath).c_str(), 1 << 16);
#else
r = archive_read_open_filename(a, archivePath.c_str(), 1 << 14);
#endif


Loading…
Cancel
Save