Corrected a bug where the root directory was not properly updated and did not handle backslashes
This commit is contained in:
parent
4f19628d53
commit
958968a852
1 changed files with 6 additions and 3 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
#include "ScopedFTZ.h"
|
#include "ScopedFTZ.h"
|
||||||
#include "StringViewHelpers.h"
|
#include "StringViewHelpers.h"
|
||||||
#include "absl/algorithm/container.h"
|
#include "absl/algorithm/container.h"
|
||||||
|
#include "absl/strings/str_replace.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -173,10 +174,12 @@ void sfz::Synth::handleControlOpcodes(const std::vector<Opcode>& members)
|
||||||
case hash("Default_path"):
|
case hash("Default_path"):
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case hash("default_path"): {
|
case hash("default_path"): {
|
||||||
auto stringPath = std::string(member.value.begin(), member.value.end());
|
const auto stringPath = absl::StrReplaceAll(trim(member.value), { { "\\", "/" } });
|
||||||
auto newPath = fs::path(stringPath);
|
const auto newPath = rootDirectory / fs::path(stringPath);
|
||||||
if (fs::exists(newPath))
|
if (fs::exists(newPath)) {
|
||||||
|
DBG("Changing default sample path to " << stringPath);
|
||||||
rootDirectory = newPath;
|
rootDirectory = newPath;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue