[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 <Wires77@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2025-10-31 06:22:53 +11:00
committed by GitHub
parent abafbf757b
commit be294d1031
2 changed files with 12 additions and 11 deletions

View File

@@ -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)

View File

@@ -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