fix: File provider sometimes not saving path to project file
This commit is contained in:
parent
def40c908e
commit
c5d2739a39
@ -51,10 +51,12 @@ namespace hex {
|
||||
bool result = true;
|
||||
for (const auto &handler : ProjectFile::getHandlers()) {
|
||||
try {
|
||||
if (!handler.load(handler.basePath, tar))
|
||||
if (!handler.load(handler.basePath, tar)) {
|
||||
log::warn("Project file handler for {} failed to load {}", filePath.string(), handler.basePath.string());
|
||||
result = false;
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
log::info("{}", e.what());
|
||||
log::warn("Project file handler for {} failed to load {}: {}", filePath.string(), handler.basePath.string(), e.what());
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
@ -297,10 +297,13 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
nlohmann::json FileProvider::storeSettings(nlohmann::json settings) const {
|
||||
std::string path;
|
||||
if (auto projectPath = ProjectFile::getPath(); !projectPath.empty())
|
||||
settings["path"] = hex::toUTF8String(std::fs::relative(this->m_path, projectPath.parent_path()));
|
||||
else
|
||||
settings["path"] = hex::toUTF8String(this->m_path);
|
||||
path = hex::toUTF8String(std::fs::proximate(this->m_path, projectPath.parent_path()));
|
||||
if (path.empty())
|
||||
path = hex::toUTF8String(this->m_path);
|
||||
|
||||
settings["path"] = path;
|
||||
|
||||
return Provider::storeSettings(settings);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user