Skip to content

Commit b15cdbe

Browse files
authored
Fix errorneous call to GetUserPath and update pop-up message (#1433)
* Fix errorneous call to GetUserPath and update pop-up message * Use fallback paths in UpdateCheck
1 parent 86ceabe commit b15cdbe

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
@@ -77,10 +77,10 @@ function main:Init()
7777
-- If running in dev mode or standalone mode, put user data in the script path
7878
self.userPath = GetScriptPath().."/"
7979
else
80-
local invalidPath
81-
self.userPath, invalidPath = GetUserPath()
80+
local invalidPath, errMsg
81+
self.userPath, invalidPath, errMsg = GetUserPath()
8282
if not self.userPath then
83-
self:OpenPathPopup(invalidPath, ignoreBuild)
83+
self:OpenPathPopup(invalidPath, errMsg, ignoreBuild)
8484
else
8585
self.userPath = self.userPath.."/Path of Building (PoE2)/"
8686
end
@@ -770,17 +770,16 @@ function main:SaveSettings()
770770
end
771771
end
772772

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

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

src/UpdateCheck.lua

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

8181
-- Use built-in helpers to obtain absolute paths without spawning a shell.
82-
local scriptPath = "."
83-
local runtimePath = "."
82+
local scriptPath, scriptFallback = GetScriptPath()
83+
scriptPath = scriptPath or scriptFallback or "."
84+
local runtimePath, runtimeFallback = GetRuntimePath()
85+
runtimePath = runtimePath or runtimeFallback or scriptPath
8486

8587
-- Load and process local manifest
8688
local localVer

0 commit comments

Comments
 (0)