Fixes to overwrite prompt not working with the folder system, as well as made quicksave copying abide folder system too

This commit is contained in:
penolakushari 2023-02-12 19:59:09 +03:00
parent 019180956f
commit b4fd710a31
3 changed files with 7 additions and 7 deletions

View File

@ -283,7 +283,7 @@ function CTRL.QuickSave()
local qs1 = "quicksave_" .. nick
local qs2 = "quicksave_" .. nick .. "_backup"
SMH.Saves.CopyIfExists(qs1, qs2)
SMH.Saves.CopyIfExists(qs1, qs2, LocalPlayer())
CTRL.Save(qs1, false)
end

View File

@ -333,7 +333,7 @@ local function RequestSave(msgLength, player)
if not isFolder then
local properties = SMH.PropertiesManager.GetAllProperties(player)
local fileExists = SMH.Saves.CheckIfExists(path)
local fileExists = SMH.Saves.CheckIfExists(path, player)
if fileExists then
local names = SMH.Saves.GetUnusedNames(path, properties, player)

View File

@ -181,12 +181,12 @@ function MGR.Serialize(keyframes, properties, player)
return serializedKeyframes
end
function MGR.CheckIfExists(path)
function MGR.CheckIfExists(path, player)
if not file.Exists(SaveDir, "DATA") or not file.IsDir(SaveDir, "DATA") then
file.CreateDir(SaveDir)
end
path = SaveDir .. path .. ".txt"
path = SaveDir .. (PlayerPath[player] or "") .. path .. ".txt"
if file.Exists(path, "DATA") and not file.IsDir(path, "DATA") then return true end
return false
@ -274,9 +274,9 @@ function MGR.AddFolder(path, player)
return path
end
function MGR.CopyIfExists(pathFrom, pathTo)
pathFrom = SaveDir .. pathFrom .. ".txt"
pathTo = SaveDir .. pathTo .. ".txt"
function MGR.CopyIfExists(pathFrom, pathTo, player)
pathFrom = SaveDir .. (PlayerPath[player] or "") .. pathFrom .. ".txt"
pathTo = SaveDir .. (PlayerPath[player] or "") .. pathTo .. ".txt"
if file.Exists(pathFrom, "DATA") then
file.Write(pathTo, file.Read(pathFrom));