|
Posted by Jerry Stuckle on 10/13/06 03:38
comp.lang.php wrote:
> Tim Roberts wrote:
>
>
>
> Ok cool, however, the requirements for this portable web app is that it
> must work in both Unix and Windows environments equally, thus,
> obviously can't just do "ls *.zip" but also "dir /w *.zip" as well; how
> does "glob" play with Windows?
>
Why not use the directory functions, such as opendir(), readdir(), etc.?
They work on all systems. You'll have to test the file extensions,
but it shouldn't be too bad as the information is cached.
>
>
> clever subdirectories are an option inasmuch as PHP requires literal
> paths for some of its functionality (I wrote a function "actual_path()"
> that takes care of that anyway), however, as this is a portable web
> application, I am not sure if that is a viable one, as this application
> is designed to "pack up and go" and install anywhere on the planet (or
> it should), one simply could not do mod_rewrite on the fly, only an
> admin customizing my tool could do that on their end. Good to suggest
> though
>
> Phil
>
> PS: I figured something out that might work for Unix/Windows:
>
> [PHP]
> if (!$_ENV['windir'] && !$_SERVER['windir']) {
> $msg = exec('stat ' . actual_path($locationPath) . '/*.zip* 2>&1');
> } else {
> list($lsKommand, $lsRedirect) =
> @array_values($this->getKommandOSArray('ls-l')); // GETS "ls" COMMAND
> APPROPRIATE FOR NON-UNIX SYSTEMS
> $msg = exec("$lsKommand \"" . actual_path($locationPath) . "/*.zip*\"
> $lsRedirect");
> }
> [/PHP]
> -
>
>>- Tim Roberts, timr@probo.com
>> Providenza & Boekelheide, Inc.
>
>
$_SERVER['DOCUMENT_ROOT'] always points to the root directory of the
server, no matter where it is or what platform you're running Apache on
(it also works with IIS). From there is' a simple matter to append the
relative path from the document root to the directory you want.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|