Re: Opendir on site root directory?
| From: | George Larson | Date: | Tue, 10 Mar 2009 01:15:53 +0000 |
| Subject: | Re: Opendir on site root directory? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289732@lists.php.net to get a copy of this message | ||
"but it had become lost in the detritus at the back of my mind"
Inappropriate as this is for _the_ PHP list -- that was a beautiful phrase,
friend.
On Mon, Mar 9, 2009 at 8:05 PM, Clancy <clancy_1@cybec.com.au> wrote:
> On Mon, 9 Mar 2009 10:07:33 +0000, stuttle@gmail.com (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
>
>