[Gambas-user] Path for open file write

Jeff Johnson jeffreyjohnson at ...1747...
Sun Jul 6 22:08:31 CEST 2008


My program also recreates html pages as the program runs, so am I correct in 
thinking that I will not be able to do that either. I am converting a hamradio 
program from VB, and will also need to do my logging. So my thinking since 
everything is RO then I am out of luck on it? 

On Sunday 06 July 2008 13:23:46 Benoit Minisini wrote:
> On dimanche 06 juillet 2008, Jeff Johnson wrote:
> > I know this has probably been replied to many times.
> >
> > This works
> >    hFile = OPEN "wxaprs.ini" FOR INPUT
> >
> > This works
> >    hFile = OPEN "./wxaprs.ini" FOR INPUT
> >
> >
> > This fails with access forbidden
> > DIM hFile1 AS File
> > hFile1 = OPEN "./wxaprs.ini" FOR OUTPUT CREATE
> >
> > This fails with access forbidden
> > DIM hFile1 AS File
> > hFile1 = OPEN "wxaprs.ini" FOR OUTPUT CREATE
>
> Relatives paths are paths to files located inside the project, and so are
> read-only.
>
> > This works
> > DIM hFile1 AS File
> > hFile1 = OPEN "/home/jeffjohnson/aprs/wxaprs.ini" FOR OUTPUT CREATE
>
> ...But when you use an absolute path, nothing is checked. But then your
> code does not work once the program is compiled into an executable.
>
> > I need to either determine the full working path so I can make it
> > hFile1 = OPEN $Path & "wxaprs.ini" FOR OUTPUT CREATE
> >
> > or the correct way to create a file
> >
> > Any ideas of where I fell off the trolley?
>
> You can't create file inside the project at execution time. You need to
> store your file inside the user home directory.
>
> You can use the Settings class, that creates a settings file like in
> Windows in a standard path inside the user home directory.
>
> Or you can create your own file, as an hidden file (beginning with a dot),
> or as a file stored inside an hidden directory.
>
> Now the standard is defined by freedesktop.org: a configuration file is
> stored in ~/.config/<application>. The Settings class stored its own
> configuration file in ~/.config/gambas[3]/<application>.conf
>
> Regards,






More information about the User mailing list