[Gambas-user] Why does gambas do this?

Richard richard.j.walker at ...247...
Sat Mar 15 01:01:31 CET 2008


Le Friday 14 March 2008 23:48:30 jbskaggs, vous avez écrit :
> Thank you that does explain some things.
>
> Now I am brand new to linux and to gambas.
>
> So when I try and use application.path in my picture load I get a not
> static error.
>
> So I assume I have to type out the full path.
>
> I also assume that I would need to install my program in the usr/bin
> directory so I can have absolute paths for users on different systems.
>
> But I dont know how to get root access on Ubuntu to place the project in
> either the home dir or usr/bin.  Any idea?
>
> JB SKaggs
>

If you are writing a file which can be unique for each user then just use 
the "abbreviation" for the user's home directory; "~/".

So if your application has a "private" directory 
at /home/jbskaggs/.mysecretplace you can use either

~/.mysecretplace/myfile

or the Gambas built in property

User.Home &/ ".mysecretplace/" &/ "myfile"

note that the &/ operator wil concatenate strings ensuring that there is at 
least one "/" character between them; ideal for joining up path names. This 
means that the "extra" slash at the end of the directory name is not doubled 
up.

> Benoit Minisini wrote:
> > On vendredi 14 mars 2008, jbskaggs wrote:
> >> Okay I have tracked down what is happening in my program and I don't
> >> know why or what to do about it.
> >>
> >> I have a settings file.  When my program runs it writes either "a" or
> >> "b" to the file.  The file saves just fine.
> >>
> >> When the program loads (on my first form form_open) it opens the file
> >> reads
> >> it and if it reads "b" then it displays a button.
> >>
> >> fstart.text=file.Load("theme.txt")
> >> textlabel4.Text=fstart.Text
> >> IF Left$(fstart.Text)="b" THEN
> >>
> >> etc etc ....
> >>
> >> then problem is when the executable is made:  At the time the executable
> >> is
> >> made theme.txt ="a" .
> >>
> >> So that now if I run the executable it always says fstart.text="a"
> >> irregardless of what is actually in the theme.txt.
> >>
> >> Why is this?
> >>
> >> How do I get gambas to read the file and update fstart.text at
> >> form_open?
> >>
> >> JB SKaggs
> >
> > Relative paths are files located in the project directory, and are always
> > *read-only* when the executable is made. You can modify it when running
> > the
> > project from the IDE, as they are real files, but when the executable is
> > made, these files become part of it, and so cannot be modified at all.
> >
> > Regards,
> >
> > --
> > Benoit Minisini
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list