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 / writing to file issue

Author
Message
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 22nd Jun 2013 17:55
when running


with a txt file called file in the media folder nothing happens. isn't the folder supposed to be opened and the text and other information inserted?

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2013 18:36
I don't even have to look at your code to answer your question.

No matter what you do, you cannot affect anything in the media directory.

Any and all write operations end up in the appropriate sandbox for the platform. In Windows it is Documents\AGK\<yourapp>\media.

If you write a file with the same name as one in the media directory, the next time you go to read it it will be read from the sandbox area.

Open operations for reading/loading always check the sandbox area first, then they check the media directory.

Open operations for writing/saving only work in the sandbox area.

Now, I just looked at your code. The commands you are using for writing are the binary versions. So, when you do find the file in the sandbox area, it won't be human readable. If you want a human readable file, you can only use WriteLine.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jun 2013 18:54
From the help docs:
Quote: "
Opens a file stored on the local filesystem for writing into the specified ID. All platforms are restricted to a single folder for writing so file paths must be relative, not absolute. This write folder is not the same folder as the application itself, so images, sounds, and the application itself cannot be overwritten.
"


GetWritePath() will tell you where your files are being created.

For a better understanding, read the new clarified version of the setFolder command I wrote.

http://www.zimnox.com/resources/agk/docs/index.php/?c=SetFolder

kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 22nd Jun 2013 20:08
how would I change the location as my app I stored in dropbox

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2013 21:00
Well, as long as you are only using the AppGameKit commands for writing, you can never write outside of the sandbox area. Period, not negotiable.

This is also something that many publishing platforms are pretty much insisting on now (Apple and Google).

(In Tier 2, if you use standard C++ file/directory stuff, you might be able to pick and choose more where stuff is written and read from. But that might upset the publishers.)

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 24th Jun 2013 21:16
when exporting the application do i neeed to copy the file aswell?

kirtnicholls
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jun 2013 21:24
If you need to redistribute the file you created in the write directory, then yes you should copy it over to your media folder.

Login to post a reply

Server time is: 2024-05-07 20:31:56
Your offset time is: 2024-05-07 20:31:56