Re: GladeXML and relative path

From: Date: Sat, 17 Nov 2001 21:06:48 +0000
Subject: Re: GladeXML and relative path
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-607@lists.php.net to get a copy of this message
Hi Markus, Well I would say that php is broken on Linux and Uinx! Executing a script in an other directory than the current for the terminal window should not change the current working directory. If you write a small program like this #include <unistd.h> int main() { char cwd[1024]; getcwd(cwd,1024); printf("CWD = %s\n", cwd); } It works as expected on both Linux, Unix and Windows. It returns the current working directory for the terminal and not for the location of the executable. - Frank > And why does this work within linux? > > getcwd() just before accessing the file tells mit shell the shell > directory on win32 but script directory on linux. > > - Markus > > On Sat, Nov 17, 2001 at 11:50:35AM -0800, Frank M. Kromann wrote : > > Current working directory is always the active directory when php.exe (or php_win.exe) is > > loaded. > > > > There is two ways to "fix" this problem. > > > > 1) add c:\php-gtk to your system path and execute the script from the directory where it > > is located. > > > > 2) execute the script from the location with c:\php-gtk\php -q <script name> > > > > I like option 2 the most. That way I can have more than one php installation on my system. > > > > Remember if you create shortcuts to php/php-gtk applications you should alwasy specify the > > full path to php.exe and set the working directory to the location of the script. > > > > - Frank > > > > > Seems to be a win32 problem only. Some testing showed that > > > c-system function 'getcwd()' spits out the directory of the > > > script under linux but the directory from the shell prompt under > > > win32. > > > > > > Frank, any idea? > > > > > > On Sat, Nov 17, 2001 at 05:14:32PM +0100, Urs Gehrig wrote : > > > > dear all > > > > > > > > while trying to load a glade file it occurred, that it would work under the > > > > condition: > > > > > > > > a) > > > > c:\php-gtk\php.exe > > > > c:\php-gtk\gtk-glade.php > > > > $g = &new GladeXML("dialog.glade"); // line within gtk-glade.php > > > > c:\php-gtk\dialog.glade > > > > > > > > c:\php-gtk\>php -q gtk-glade.php > > > > > > > > but it did not work under the condition, that the glade file is in any other > > > > location than the dialog.glade file, like: > > > > > > > > b) > > > > c:\php-gtk\php.exe > > > > c:\php-gtk\projects\glade\gtk-glade.php > > > > $g = &new GladeXML("dialog.glade"); // line within gtk-glade.php > > > > or > > > > $g = &new GladeXML("./dialog.glade"); // line within > > > > gtk-glade.php > > > > c:\php-gtk\projects\glade\dialog.glade > > > > > > > > C:\PHP-GTK>php -q C:\PHP-GTK\projects\glade\gtk-glade.php > > > > ----> produces: warning: failed to load external entity > > > > "./dialog.glade" > > > > > > > > so, actually i would have expected, that the glade file would be found, if > > > > it is in the same directory as the gtk-glade.php file itself. but this does > > > > not seem to work. maybe i am wrong. but at least, this would be the way, i > > > > intuitively would call the glade file. > > > > > > > > well, that would not be that much a problem, if i could use something like > > > > $GLOBALS[PATH_TRANSLATED] to point for the glade file. but since this is not > > > > online-called file but calle through command line, PATH_TRANSLATED does not > > > > seam to be defined at all. > > > > > > -- > > > PHP-GTK General Mailing List (http://gtk.php.net/) > > > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-gtk-general-help@lists.php.net > > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > > > > > > > > -- > Markus Fischer, http://guru.josefine.at/~mfischer/ > EMail: mfischer@guru.josefine.at > PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc > PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 > -All your scripts are belong to Zend- > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.gtk.general (#607) next »