Essentials gets the saved games folder path by invoking
SHGetKnownFolderPath through
Win32API. This uses GUID of the folder paths which you can find documented
here. The only annoying bit is that you have to split the GUID into correct hex chunks for
def getKnownFolder. I've made a small module for myself to automate this process, and make it a bit easier.
Code:
module Env
COMMON_PATHS = {
"CAMERA_ROLL" => "AB5FB87B-7CE2-4F83-915D-550846C9537B",
"START_MENU" => "A4115719-D62E-491D-AA7C-E74B8BE3B067",
"DESKTOP" => "B4BFCC3A-DB2C-424C-B029-7FE99A87C641",
"DOCUMENTS" => "FDD39AD0-238F-46AF-ADB4-6C85480369C7",
"DOWNLOADS" => "374DE290-123F-4565-9164-39C4925E467B",
"HOME" => "5E6C858F-0E22-4760-9AFE-EA3317B67173",
"MUSIC" => "4BD8D571-6D19-48D3-BE97-422220080E43",
"PICTURES" => "33E28130-4E1E-4676-835A-98395C3BC3BB",
"SAVED_GAMES" => "4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4",
"SCREENSHOTS" => "b7bede81-df94-4682-a7d8-57a52620b86f",
"VIDEOS" => "18989B1D-99B5-455B-841C-AB7C74E4DDFC",
"LOCAL" => "F1B32785-6FBA-4FCF-9D55-7B8E7F157091",
"LOCALLOW" => "A520A1A4-1780-4FF6-BD18-167343C5AF16",
"ROAMING" => "3EB685DB-65F9-4CF6-A03A-E3EF65729F3D",
"PROGRAM_DATA" => "62AB5D82-FDC1-4DC3-A9DD-070D1D495D97",
"PROGRAM_FILES_X64" => "6D809377-6AF0-444b-8957-A3773F02200E",
"PROGRAM_FILES_X86" => "7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E",
"COMMON_FILES" => "F7F1ED05-9F6D-47A2-AAAE-29D317C6F066",
"PUBLIC" => "DFDF76A2-C82A-4D63-906A-5644AC457385",
}
def self.path(type)
hex = self.guidToHex(COMMON_PATHS[type])
return getKnownFolder(hex)
end
def self.guidToHex(string)
chunks = string.split("-")
hex = []
for i in 0...chunks.length
chunk = chunks[i]
if i < 3
hex.push(chunk.hex)
else
split = chunk.scan(/../)
for s in split
hex.push(s.hex)
end
end
end
return hex
end
end
I've recorded most of the common paths and their GUIDs in the module, and you can very easily get the folder path with a simple command such as
You can edit the save folder by changing the value the
def self.getSaveFolder returns; so your function could basically look like this
Code:
def self.getSaveFolder
return Env.path("ROAMING")
end
This isn't anywhere "safe" enough to fully prevent cheating. The most optimal way for that would be what
@FireBurn256 suggested and you'd want access to your online files in an ideal situation.