|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Path for open file writeI 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 This works DIM hFile1 AS File hFile1 = OPEN "/home/jeffjohnson/aprs/wxaprs.ini" FOR OUTPUT CREATE 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? ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: Path for open file writeOn 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, -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: Path for open file writeMy 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, ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: Path for open file writeOn dimanche 06 juillet 2008, Jeff Johnson wrote:
> 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? > Only your project is read-only. If the pages you create are temporary, i.e. they disappear when the program ends, then you can use the process temporary directory created by the interpreter (Temp$ function). If the pages you create are persistent, then you must store them inside the user home directory, or in another directory specified by him. If you are doing a program that is run by root or another priviledged user, you should store your logs in /var/log. Regards, -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: Path for open file writePharm out... That is what I needed to know.. Thanks a bundle
On Sunday 06 July 2008 15:21:36 Benoit Minisini wrote: > On dimanche 06 juillet 2008, Jeff Johnson wrote: > > 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? > > Only your project is read-only. > > If the pages you create are temporary, i.e. they disappear when the program > ends, then you can use the process temporary directory created by the > interpreter (Temp$ function). > > If the pages you create are persistent, then you must store them inside the > user home directory, or in another directory specified by him. > > If you are doing a program that is run by root or another priviledged user, > you should store your logs in /var/log. > > Regards, ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
| Free Forum Powered by Nabble | Forum Help |