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 / Location of writing to files [APPDATA]

Author
Message
EdzUp
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 1st Jul 2019 20:24
Is there a way to stop AppGameKit to write data files to AppData/AGKApps/myapp but instead write to the directory the app actually is in, I write a lot of data files at random times and keep getting them from AppData to put them into my game is a pain in the butt.

Anyone have any ideas on this?
-EdzUp
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 1st Jul 2019 20:51
EdzUp
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 1st Jul 2019 20:55
Thanks fubarpk I never knew that was there
-EdzUp
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 1st Jul 2019 21:09
no worries
you can also set the raw path when writing files to be the any folder
for example in my very basic barebones 3D placement editor I retrieve
the path of the object loaded, load the image and then I know where to save
to. https://forum.thegamecreators.com/thread/222027?page=3
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
EdzUp
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 1st Jul 2019 21:27
Thank you fubarpk
-EdzUp
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 3rd Aug 2019 21:51
Hello,
except that SetFolder() doesn't work for me!!!

I'm testing this code::




in step-by-step mode, and I don't get any files!
(windows 10 updated, and latest version of AGK2)

even by forcing a writing path, I get nothing at all!
Carpe Diem
Increase
7
Years of Service
User Offline
Joined: 21st Feb 2017
Location:
Posted: 3rd Aug 2019 21:59 Edited at: 3rd Aug 2019 22:01
Worldwide optimal state system - ISBN 9783748157748
Weltweit optimales Staatssystem - ISBN 9783748159476
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 3rd Aug 2019 22:00
I even tested this: setfolder("D:\App Game Kit 2\Projects\zip_file") without results!


note; I am a Purebasic coder, and I have no problem writing files...
Carpe Diem
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 3rd Aug 2019 22:01 Edited at: 3rd Aug 2019 22:11
Thanks, I'll try.
Carpe Diem
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 3rd Aug 2019 22:05 Edited at: 3rd Aug 2019 22:10
Yes, it works with this method
but not with SetFolder()!!!


and because of that, I can't use the zip-related functions,
for the same reason


ps: Sorry for the multiple messages
I hadn't seen the edit button
Carpe Diem
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Aug 2019 23:30
try
setfolder("raw:D:\App Game Kit 2\Projects\zip_file")

I'm not sure SeFolder() will set the drive as well

Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 4th Aug 2019 19:25 Edited at: 4th Aug 2019 20:35
@blink0k Thank you, but it doesn't work for me.

setfolder() doesn't work on my system ! , with any syntax (windows10 familiale 1809 )

(antivirus off , firewall off )


this code work ===>

Carpe Diem
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Aug 2019 21:36
Reading the SetFolder() documentation
Quote: "To access folders outside the read and write folders you can use the OpenRawFolder commands. "
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 4th Aug 2019 22:39 Edited at: 4th Aug 2019 22:53
@blink0k :
ok
Carpe Diem
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Aug 2019 22:52
try
C:\Users\Your_id\AppData\Local\AGKApps\Your_app\
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 4th Aug 2019 22:58 Edited at: 4th Aug 2019 23:10
@blink0k : ok ...
Indeed,... it is......

Too bad SetFolder doesn't take into account the location of the source...

you'll have to add in the doc that the location is arbitrarily chosen on "C:\Users\Pseudo\AppData\Local\AGKApps\Windows\folder_app"

when it should give the location of our project file

in API windows (c++)

DWORD GetCurrentDirectory(
DWORD nBufferLength,
LPTSTR lpBuffer
);

or in Purebasic :
path_application.s = GetCurrentDirectory()


in api windows, it returns the path of our executable




with AGK2 it's weird to go looking to read a site that has nothing to do with our program.






Thanks you ...
Carpe Diem
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Aug 2019 23:03
It was originally designed as a sandbox application so it couldn't write files outside a controlled area.
This helps when getting approval for mobile apps.
If you want to operate outside those protections then use the Raw functions
Dobro
6
Years of Service
User Offline
Joined: 23rd Apr 2018
Location: France
Posted: 4th Aug 2019 23:07
Well, I'll know in the future, thank you again for your time to answer me.
Carpe Diem

Login to post a reply

Server time is: 2024-04-23 17:39:31
Your offset time is: 2024-04-23 17:39:31