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 / Where AGK saves the files on Raspberry pi?

Author
Message
Brny
9
Years of Service
User Offline
Joined: 12th Oct 2015
Location:
Posted: 20th Jun 2016 04:45

Hi, i am making a program that i need to open the text files and edit them all the time, how can i do to make the program save the write files on /media, or

instead, where is the write folder on raspberry to find them?


Thanks
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Jun 2016 11:05
If you put the original files in your media folder. you can OpenToWrite() and OpenToRead() without worrying about the exact location.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Brny
9
Years of Service
User Offline
Joined: 12th Oct 2015
Location:
Posted: 20th Jun 2016 13:30
But you must do it before the first compilation of the program no? because i have the files on /media and it reads the files but doesen't write anyone.

I have an Hypothesis:

If you first run the program and the files are not there, it creates the files on its own hidden folder, and then if after that you add the files on /media, it will not use them

because will only use the ones that has created before on it's own hidden folder. ¿Is that right?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Jun 2016 13:51
All files are written to /home/pi/.config/AGKApps/[AppName], if you call OpenToRead it will first check that path for a file, if it doesn't find it it will look in /media.
Brny
9
Years of Service
User Offline
Joined: 12th Oct 2015
Location:
Posted: 20th Jun 2016 19:32 Edited at: 20th Jun 2016 19:37
Thanks for the answers

Ok, so there's no way to call opentowrite on the /media folder of the app or store the written files there, that's what i understand.

For example, i make a file on the /media folder, the one where is also bytecode.byc and then i want to write a line on it. If i call opentowrite("file"), it looks on /media for the file at some point?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 20th Jun 2016 20:14
OpenToWrite will only ever write to the /home/pi/.config/AGKApps/[AppName] folder. This mimics other platforms like iOS and Android that cannot write to the media folder.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Jun 2016 21:13
This is the step-by-step process...

1. Add a file to your media folder (myFile.dat).
2. Deploy the application
3. Run application
4. Open /media/myFile.dat to write/append. It is opened from media subfolder in App folder
5. File is copied to /home/pi/.config/AGKApps/[AppName]/myFile.dat
6. Write to file
7. Save File
8. Close App
9. Run App
10. Open /media/myFile.dat to write/append. File already exists in /home/pi/.config/AGKApps/[AppName] so this version is opened and edited.
11. etc etc etc
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-25 06:50:49
Your offset time is: 2024-11-25 06:50:49