Fixed an issue where folder links couldn't be used inside folders.

This commit is contained in:
Leon Styhre 2023-03-03 17:11:53 +01:00
parent b89abd7d3b
commit 7ae3f7209f
2 changed files with 13 additions and 13 deletions

View file

@ -38,7 +38,7 @@
GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
const std::vector<MetaDataDecl>& mdd, const std::vector<MetaDataDecl>& mdd,
ScraperSearchParams scraperParams, const ScraperSearchParams scraperParams,
std::function<void()> saveCallback, std::function<void()> saveCallback,
std::function<void()> clearGameFunc, std::function<void()> clearGameFunc,
std::function<void()> deleteGameFunc) std::function<void()> deleteGameFunc)
@ -433,14 +433,15 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
if (originalValue != "") if (originalValue != "")
mInvalidFolderLinkEntry = true; mInvalidFolderLinkEntry = true;
for (auto child : mScraperParams.game->getChildrenRecursive()) { for (auto child : scraperParams.game->getChildrenRecursive()) {
if (child->getType() == GAME && child->getCountAsGame() && if (child->getType() == GAME && child->getCountAsGame() &&
!child->getHidden()) { !child->getHidden()) {
children.emplace_back(child); children.emplace_back(child);
std::string filePath {child->getPath()}; std::string filePath {child->getPath()};
std::string systemPath {child->getSystem()->getRootFolder()->getPath() + filePath = Utils::String::replace(filePath,
"/" + mScraperParams.game->getFileName() + "/"}; scraperParams.game->getPath() + "/", "");
if (Utils::String::replace(filePath, systemPath, "") == originalValue) if (Utils::String::replace(filePath, scraperParams.game->getPath() + "/",
"") == originalValue)
mInvalidFolderLinkEntry = false; mInvalidFolderLinkEntry = false;
} }
} }
@ -456,7 +457,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
#endif #endif
// OK callback (apply new value to ed). // OK callback (apply new value to ed).
auto updateVal = [this, ed, originalValue](const std::string& newVal) { auto updateVal = [this, ed, originalValue,
scraperParams](const std::string& newVal) {
mInvalidFolderLinkEntry = false; mInvalidFolderLinkEntry = false;
ed->setValue(newVal); ed->setValue(newVal);
if (newVal == originalValue) if (newVal == originalValue)
@ -465,7 +467,7 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
ed->setColor(TEXTCOLOR_USERMARKED); ed->setColor(TEXTCOLOR_USERMARKED);
}; };
row.makeAcceptInputHandler([this, children, title, ed, updateVal] { row.makeAcceptInputHandler([this, children, title, ed, updateVal, scraperParams] {
GuiSettings* s {new GuiSettings(title)}; GuiSettings* s {new GuiSettings(title)};
for (auto child : children) { for (auto child : children) {
@ -474,10 +476,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
ComponentListRow row; ComponentListRow row;
std::string filePath {child->getPath()}; std::string filePath {child->getPath()};
std::string systemPath {child->getSystem()->getRootFolder()->getPath() + filePath = Utils::String::replace(filePath,
"/" + mScraperParams.game->getFileName() + "/"}; scraperParams.game->getPath() + "/", "");
filePath = Utils::String::replace(filePath, systemPath, "");
std::shared_ptr<TextComponent> labelText {std::make_shared<TextComponent>( std::shared_ptr<TextComponent> labelText {std::make_shared<TextComponent>(
label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF)}; label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF)};
@ -548,7 +548,7 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
bool multiLine {it->type == MD_MULTILINE_STRING}; bool multiLine {it->type == MD_MULTILINE_STRING};
const std::string title {it->displayPrompt}; const std::string title {it->displayPrompt};
gamePath = Utils::FileSystem::getStem(mScraperParams.game->getPath()); gamePath = Utils::FileSystem::getStem(scraperParams.game->getPath());
// OK callback (apply new value to ed). // OK callback (apply new value to ed).
auto updateVal = [ed, currentKey, originalValue, gamePath, auto updateVal = [ed, currentKey, originalValue, gamePath,

View file

@ -29,7 +29,7 @@ class GuiMetaDataEd : public GuiComponent
public: public:
GuiMetaDataEd(MetaDataList* md, GuiMetaDataEd(MetaDataList* md,
const std::vector<MetaDataDecl>& mdd, const std::vector<MetaDataDecl>& mdd,
ScraperSearchParams params, const ScraperSearchParams params,
std::function<void()> savedCallback, std::function<void()> savedCallback,
std::function<void()> clearGameFunc, std::function<void()> clearGameFunc,
std::function<void()> deleteGameFunc); std::function<void()> deleteGameFunc);