From be294d1031feee1947bfbdeca9d6d561897697e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 06:22:53 +1100 Subject: [PATCH] [pob2-port] Fix errorneous call to GetUserPath and update pop-up message (#9082) * Apply changes from https://github.com/PathOfBuildingCommunity/PathOfBuilding-PoE2/pull/1433 * Fix conflicts Refactor path retrieval to use fallback options. * Fix merge conflict Updated user settings path error message to provide clearer instructions. --------- Co-authored-by: Wires77 --- src/Modules/Main.lua | 17 ++++++++--------- src/UpdateCheck.lua | 6 ++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Modules/Main.lua b/src/Modules/Main.lua index ac5b5856..4ab0fc2b 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -83,10 +83,10 @@ function main:Init() -- If running in dev mode or standalone mode, put user data in the script path self.userPath = GetScriptPath().."/" else - local invalidPath - self.userPath, invalidPath = GetUserPath() + local invalidPath, errMsg + self.userPath, invalidPath, errMsg = GetUserPath() if not self.userPath then - self:OpenPathPopup(invalidPath, ignoreBuild) + self:OpenPathPopup(invalidPath, errMsg, ignoreBuild) else self.userPath = self.userPath.."/Path of Building/" end @@ -769,17 +769,16 @@ function main:SaveSettings() end end -function main:OpenPathPopup(invalidPath, ignoreBuild) +function main:OpenPathPopup(invalidPath, errMsg, ignoreBuild) local controls = { } local defaultLabelPlacementX = 8 controls.label = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, 20, 206, 16 }, function() - return "^7User settings path contains unicode characters and cannot be loaded.".. + return "^7User settings path cannot be loaded: ".. errMsg .. "\nCurrent Path: "..invalidPath:gsub("?", "^1?^7").."/Path of Building/".. - "\nSpecify a new location for your Settings.xml:" - end) - controls.explainButton = new("ButtonControl", { "LEFT", controls.label, "RIGHT" }, { 4, 0, 20, 20 }, "?", function() - OpenURL("https://github.com/PathOfBuildingCommunity/PathOfBuilding/wiki/Why-do-I-have-to-change-my-Settings-path%3F") + "\nIf this location is managed by OneDrive, navigate to that folder and manually try" .. + "\nto open Settings.xml in a text editor before re-opening Path of Building" .. + "\nOtherwise, specify a new location for your Settings.xml:" end) controls.userPath = new("EditControl", { "TOPLEFT", controls.label, "TOPLEFT" }, { 0, 60, 206, 20 }, invalidPath, nil, nil, nil, function(buf) invalidPath = sanitiseText(buf) diff --git a/src/UpdateCheck.lua b/src/UpdateCheck.lua index 84c2205e..7d3f8bec 100644 --- a/src/UpdateCheck.lua +++ b/src/UpdateCheck.lua @@ -89,8 +89,10 @@ end ConPrintf("Checking for update...") -- Use built-in helpers to obtain absolute paths without spawning a shell. -local scriptPath = (GetScriptPath and GetScriptPath()) or "." -local runtimePath = (GetRuntimePath and GetRuntimePath()) or scriptPath +local scriptPath, scriptFallback = GetScriptPath() +scriptPath = scriptPath or scriptFallback or "." +local runtimePath, runtimeFallback = GetRuntimePath() +runtimePath = runtimePath or runtimeFallback or scriptPath -- Load and process local manifest local localVer