Specialfilefolder

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
tyarmsteadBUSuSfT
Posts: 151
Joined: Sat Aug 25, 2012 1:14 am

Specialfilefolder

Post by tyarmsteadBUSuSfT » Sun Nov 25, 2012 7:14 pm

I'm working on my first app with RunRev, and my app will be required to read from an existing file that I will include with the app as well as create a file that the the user can modify within the app. The app will be designed for Iphone, Ipad and Android. My question is when I am tell it where to look or create the file what path do I use?
Thank you,
Ty

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Specialfilefolder

Post by Mark » Sun Nov 25, 2012 7:51 pm

Hi Ty,

There are several ways to do this. You can include a file with the engine using the Copy Files tab of the Standalone Application Settings window. You could get the contents of the file with one of the following:

Code: Select all

put url ("file:" & specialfolderpath("engine") & "/filename.txt") into myData
put url ("binfile:" & specialfolderpath("engine") & "/filename.txt") into myData
You could also set a custom property to the data of that file. That saves you the trouble of getting around permission problems.

You can save a user document in the documents folder:

Code: Select all

put myData into url ("binfile:" & specialfolderpath("documents") & "/filename.txt")
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

tyarmsteadBUSuSfT
Posts: 151
Joined: Sat Aug 25, 2012 1:14 am

Re: Specialfilefolder

Post by tyarmsteadBUSuSfT » Sun Nov 25, 2012 8:44 pm

Thank you very much.

One followup, when the user saves info to a file do I also use the same concept? the file will hold previous lines of saved items and allows the user to delete specific lines.
Thank you again.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Specialfilefolder

Post by Mark » Sun Nov 25, 2012 9:36 pm

Hi,

Yes, sure, it doesn't matter if you're just saving data once or reading, modifying and saving the data.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Specialfilefolder

Post by Klaus » Mon Nov 26, 2012 1:55 pm

Hi guys,

this is everything but OFF-TOPIC (HINT, HINT!), so I will move this thread to the beginners section.


Best

Klaus

Post Reply