Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [Tier 1] Can I save a file right in the games directory?

Author
Message
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 15th Nov 2017 12:11
Normally, AGK2 lets you save files in this obscure directory:

C:\Users\USERNAME\AppData\Local\AGKApps\GAME\media\

Which somehow is perfectly logicial, I guess. But the player has no way of knowing that the files will be saved there. So for userfriendlines sake, I would much prefer to be able to just save the files right in the games directory.

Is there a way to do this?
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Nov 2017 16:30
Look at the raw write commands.
Click here for VR Legend of Zelda stuff
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Nov 2017 19:42
if you filename begins with "raw::" you can reference any file anywhere
ie: "raw:c:/my documents/word/word doc.doc"
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 15th Nov 2017 20:04
SetRawWritePath( GetReadPath() )

that works for me regardless of where they chose to place the exe

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 15th Nov 2017 20:55

"Conjured Entertainment" wrote: "SetRawWritePath( GetReadPath() )"


O! What a devious trick -- not sure it's entirely legal but it WORKS!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 15th Nov 2017 22:08 Edited at: 15th Nov 2017 22:09
there is also a command for user documents path at pc.
GetDocumentsPath ()

paul gave us this command because this path was used before AppData^^
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Nov 2017 23:08
If the App Path is in Program Files, then you won't be able to reliably save any files there.
Use the Documents folder as suggested by Markus for a reliable and easily found solution.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 16th Nov 2017 13:21
Quote: "If the App Path is in Program Files, then you won't be able to reliably save any files there.
Use the Documents folder as suggested by Markus for a reliable and easily found solution."

I'll try that.

SetRawWritePath( GetDocumentsPath () )

Thanks guys

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 17th Nov 2017 16:48
"Conjured Entertainment" wrote: "SetRawWritePath( GetDocumentsPath () )"


Tried it, and it created a \media subfolder in my Documents folder. Not really what I wanted! So I think I'll abandon SetRawWritePath() and instead do like this:

SaveImage( imgStuff, "raw:" + GetDocumentsPath () + "\Spoon Game\image_GOAT.png" )

One problem: The code should check if the directory \Spoon Game exists and if not, create it. But how do I check the existence of a directory?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Nov 2017 22:16
setfolder() should return 0 for an invalid folder
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 18th Nov 2017 14:49
Thanks, but setfolder() seem to go nuts if you try to make it do stuff outside the default read/write directories.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 18th Nov 2017 18:44 Edited at: 18th Nov 2017 18:47
you should be able to just make a folder using
MakeFolder("raw:" + GetDocumentsPath () + "\Spoon Game")
if the folder already exists it won't do anything (all files inside are kept etc).
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 18th Nov 2017 19:10
You know, that works! Thanks!

Login to post a reply

Server time is: 2024-11-24 06:00:55
Your offset time is: 2024-11-24 06:00:55