reading & writing files

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

reading & writing files

Postby RobertMeyer » Sat Mar 27, 2004 12:12 am

when using application.readTXTFile() & application.writeTXTFile()
to work with files on the user's machine, it seems that both
functions are creating and expecting to find files related
to the servoy folder.

i need to read (& write) files in the user's home directory
(mac os 10.3).

i've tried using plugins.file.getHomeDirectory() to get a
path to the user's home directory ("/users/robertmeyer"),
then specifing that value to writeTXTFile(), but it returns
'false', and the file is not created.

how can i read & write files in places other than the servoy
directory?

rc9-b268

thanks.
rm.
RobertMeyer
 
Posts: 268
Joined: Sat Dec 27, 2003 9:05 pm

Postby IT2Be » Sun Mar 28, 2004 12:12 pm

Robert,

plugins.file.getHomeDirectory() gives you a JSFile. That means you first have to convert that to an absolutepath with:

plugins.file.getHomeDirectory().getAbsolutePath()...

That way you have a string you can use for reading and writing that file into the home directory...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby RobertMeyer » Sat Apr 03, 2004 6:08 pm

perfect!

you have saved the day once again Marcel.
thank you.

are you affiliated with the servoy group?
RobertMeyer
 
Posts: 268
Joined: Sat Dec 27, 2003 9:05 pm

Postby IT2Be » Sat Apr 03, 2004 6:10 pm

nope, I just like to work with the 8) Servoy environment...

Wow, I just noticed that your comment triggered me to do my 1.000th posting on this forum...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby RobertMeyer » Mon Apr 05, 2004 4:41 pm

IT2BE wrote:Wow, I just noticed that your comment triggered me to do my 1.000th posting on this forum...

wow!

probably about half of those were you helping me...
RobertMeyer
 
Posts: 268
Joined: Sat Dec 27, 2003 9:05 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 5 guests