Re: Opendir on site root directory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 9 Mar 2009 10:07:33 +0000, stuttle@xxxxxxxxx (Stuart) wrote:

.......
>As in the example script I've posted above you can refer to the current
>working directory with a single period (.), but this is still relying on the
>current working directory being what you expect it to be.

Thank you! This is what I had been looking for all along. I dimly remembered some such
trick, but it had become lost in the detritus at the back of my mind.

But why the obsession with avoiding getcwd()? When my site is loaded the current directory
is always the root directory of the page, and as I never change directory I can rely on it
staying there. (And, incidentally, since getcwd(), dirname(__FILE__), etc, all return the
complete path including system dependent information, if I really didn't know the current
directory it would not be a trivial task to determine what was the local root.)

For a couple of years I have been using getcwd() to determine whether or not I am running
on my local PC (if I am the path will start with 'D:'). If I am running on the local PC I
load various editing and other private facilities, otherwise I omit them. This is done in
such a way that there is nothing to indicate that anything is either missing or has been
omitted.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux