Skip to content

Commit be294d1

Browse files
[pob2-port] Fix errorneous call to GetUserPath and update pop-up message (#9082)
* Apply changes from PathOfBuildingCommunity/PathOfBuilding-PoE2#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 <Wires77@users.noreply.github.com>
1 parent abafbf7 commit be294d1

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/Modules/Main.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ function main:Init()
8383
-- If running in dev mode or standalone mode, put user data in the script path
8484
self.userPath = GetScriptPath().."/"
8585
else
86-
local invalidPath
87-
self.userPath, invalidPath = GetUserPath()
86+
local invalidPath, errMsg
87+
self.userPath, invalidPath, errMsg = GetUserPath()
8888
if not self.userPath then
89-
self:OpenPathPopup(invalidPath, ignoreBuild)
89+
self:OpenPathPopup(invalidPath, errMsg, ignoreBuild)
9090
else
9191
self.userPath = self.userPath.."/Path of Building/"
9292
end
@@ -769,17 +769,16 @@ function main:SaveSettings()
769769
end
770770
end
771771

772-
function main:OpenPathPopup(invalidPath, ignoreBuild)
772+
function main:OpenPathPopup(invalidPath, errMsg, ignoreBuild)
773773
local controls = { }
774774
local defaultLabelPlacementX = 8
775775

776776
controls.label = new("LabelControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, 20, 206, 16 }, function()
777-
return "^7User settings path contains unicode characters and cannot be loaded."..
777+
return "^7User settings path cannot be loaded: ".. errMsg ..
778778
"\nCurrent Path: "..invalidPath:gsub("?", "^1?^7").."/Path of Building/"..
779-
"\nSpecify a new location for your Settings.xml:"
780-
end)
781-
controls.explainButton = new("ButtonControl", { "LEFT", controls.label, "RIGHT" }, { 4, 0, 20, 20 }, "?", function()
782-
OpenURL("https://github.com/PathOfBuildingCommunity/PathOfBuilding/wiki/Why-do-I-have-to-change-my-Settings-path%3F")
779+
"\nIf this location is managed by OneDrive, navigate to that folder and manually try" ..
780+
"\nto open Settings.xml in a text editor before re-opening Path of Building" ..
781+
"\nOtherwise, specify a new location for your Settings.xml:"
783782
end)
784783
controls.userPath = new("EditControl", { "TOPLEFT", controls.label, "TOPLEFT" }, { 0, 60, 206, 20 }, invalidPath, nil, nil, nil, function(buf)
785784
invalidPath = sanitiseText(buf)

src/UpdateCheck.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ end
8989
ConPrintf("Checking for update...")
9090

9191
-- Use built-in helpers to obtain absolute paths without spawning a shell.
92-
local scriptPath = (GetScriptPath and GetScriptPath()) or "."
93-
local runtimePath = (GetRuntimePath and GetRuntimePath()) or scriptPath
92+
local scriptPath, scriptFallback = GetScriptPath()
93+
scriptPath = scriptPath or scriptFallback or "."
94+
local runtimePath, runtimeFallback = GetRuntimePath()
95+
runtimePath = runtimePath or runtimeFallback or scriptPath
9496

9597
-- Load and process local manifest
9698
local localVer

0 commit comments

Comments
 (0)