@@ -112,6 +112,7 @@ function main:Init()
112112 self .POESESSID = " "
113113 self .showPublicBuilds = true
114114 self .showFlavourText = true
115+ self .errorReadingSettings = false
115116
116117 if not SetDPIScaleOverridePercent then SetDPIScaleOverridePercent = function (scale ) end end
117118
@@ -143,8 +144,6 @@ function main:Init()
143144 self .uniqueDB = { list = { }, loading = true }
144145 self .rareDB = { list = { }, loading = true }
145146
146- self .saveSettingsOnExit = true
147-
148147 local function loadItemDBs ()
149148 for type , typeList in pairsYield (data .uniques ) do
150149 for _ , raw in pairs (typeList ) do
@@ -517,14 +516,17 @@ function main:CallMode(func, ...)
517516end
518517
519518function main :LoadSettings (ignoreBuild )
519+ if self .errorReadingSettings then
520+ return true
521+ end
520522 local setXML , errMsg = common .xml .LoadXMLFile (self .userPath .. " Settings.xml" )
521523 if errMsg and errMsg :match (" .*file returns nil" ) then
522- self :OpenOneDriveErrPopup (self .userPath .. " Settings.xml" )
524+ self .errorReadingSettings = true
525+ self :OpenCloudErrorPopup (self .userPath .. " Settings.xml" )
523526 return true
524527 elseif errMsg and not errMsg :match (" .*No such file or directory" ) then
525- ConPrintf ( " Error: '%s' " , errMsg )
528+ self . errorReadingSettings = true
526529 launch :ShowErrMsg (" ^1" .. errMsg )
527- self .saveSettingsOnExit = false
528530 return true
529531 end
530532 if not setXML then
@@ -661,14 +663,17 @@ function main:LoadSettings(ignoreBuild)
661663end
662664
663665function main :LoadSharedItems ()
666+ if self .errorReadingSettings then
667+ return true
668+ end
664669 local setXML , errMsg = common .xml .LoadXMLFile (self .userPath .. " Settings.xml" )
665670 if errMsg and errMsg :match (" .*file returns nil" ) then
666- self :OpenOneDriveErrPopup (self .userPath .. " Settings.xml" )
671+ self .errorReadingSettings = true
672+ self :OpenCloudErrorPopup (self .userPath .. " Settings.xml" )
667673 return true
668674 elseif errMsg and not errMsg :match (" .*No such file or directory" ) then
669- ConPrintf ( " Error: '%s' " , errMsg )
675+ self . errorReadingSettings = true
670676 launch :ShowErrMsg (" ^1" .. errMsg )
671- self .saveSettingsOnExit = false
672677 return true
673678 end
674679 if not setXML then
@@ -713,7 +718,8 @@ function main:LoadSharedItems()
713718end
714719
715720function main :SaveSettings ()
716- if not self .saveSettingsOnExit then
721+ ConPrintf (" self.errorReadingSettings: %s" , self .errorReadingSettings )
722+ if self .errorReadingSettings then
717723 return
718724 end
719725 local setXML = { elem = " PathOfBuilding" }
@@ -1566,15 +1572,19 @@ function main:OpenNewFolderPopup(path, onClose)
15661572 main :OpenPopup (370 , 100 , " New Folder" , controls , " create" , " edit" , " cancel" )
15671573end
15681574
1569- --- Shows a OneDrive-specific read error popup with a help button that opens a browser to PoB's GitHub wiki.
1570- function main :OpenOneDriveErrPopup (fileName )
1571- ConPrintf (" Error: OneDrive: file unreadable: %s" , fileName or " ?" )
1575+ -- Show an error popup if a file cannot be read due to cloud provider unavailability.
1576+ -- Help button opens a URL to PoB's GitHub wiki.
1577+ function main :OpenCloudErrorPopup (fileName )
1578+ local provider , _ , status = GetCloudProvider (fileName )
1579+ ConPrintf (' Error: file offline "%s" provider: "%s" status: "%s"' ,
1580+ fileName or " ?" , provider , status )
15721581 fileName = fileName and " \n\n ^8'" .. fileName .. " '" or " "
1573- local longVersion = " ^8v" .. launch .versionNumber .. (launch .versionBranch == " dev" and " (Dev)" or launch .versionBranch == " beta" and " (Beta)" or " " )
1574- local title = " Cannot read file "
1575- local msg = " \n Make sure OneDrive is running then restart " .. APP_NAME .. " and try again." .. fileName .. " \n\n " .. longVersion
1576- local url = " https://github.com/PathOfBuildingCommunity/PathOfBuilding/wiki/OneDrive"
1577- self .saveSettingsOnExit = false
1582+ local pobVersion = " ^8v" .. launch .versionNumber .. (launch .versionBranch == " dev" and " (Dev)" or launch .versionBranch == " beta" and " (Beta)" or " " )
1583+ local title = " Error "
1584+ provider = provider or " your cloud provider"
1585+ local msg = " \n Cannot read file.\n\n Make sure " .. provider .. " is running then restart " .. APP_NAME .. " and try again." ..
1586+ fileName .. " \n\n " .. pobVersion
1587+ local url = " https://github.com/PathOfBuildingCommunity/PathOfBuilding/wiki/CloudError"
15781588 local controls = { }
15791589 local numMsgLines = 0
15801590 for line in string.gmatch (msg .. " \n " , " ([^\n ]*)\n " ) do
0 commit comments