Windows filenames and "/" (was Re: logtext and logfile)

Fairlight fairlite at fairlite.com
Mon Mar 3 11:48:03 PST 2008


Is it just me, or did Kenneth Brody say:
> No, filePro doesn't care.  Perhaps a better wording would have been "unless
> you're passing the filename to SYSTEM, and running a command which does
> care about them, there is no need to flip the slashes under Windows".  The
> point is, once you're passing the filename to something outside of filePro,
> you have to know the "other side" in order to get a definitive answer to
> the question.  Everything (well, probably everything) will accept paths
> with backslashes from the command line.

Makes sense on all points.

> How does Perl's system() handle things like "dir \path\to\directory /w"?

Depends how you quote it to system().  If you use interpolating quotes,
then something like "dir \temp /w" results in a directory not found.  If
you use non-interpolating quotes, it's fine because it hasn't changed it to
a tab (in this example) rather than a literal \t.  This only holds (I
believe) if you are doing this on the command line with a literal string
inside interpolating quotes.  If you have a variable that gets its contents
elsewhere and feed -that- to system(), it won't double-interpolate the
variable.  So if you had:

$cmd = 'dir \temp /w';
system("$cmd extra_args");

...That would work.  Now if you used interpolating quotes (ie.,
doublequotes, or qq()) when assigning $cmd in the first place, all bets are
off again because you're telling it to interpolate backslashes before it
even hits system().

It's really not a matter of system() itself, but rather how and if you
interpolate, and where.  You just have to remember that perl won't double
interpolate, but it will single interpolate. :) (I've tried, with no
success, to get things I -needed- double interpolated to do so, to no
measure of success.)

And damn CP/M for starting the whole slash war to begin with.  It -was-
originated there, right?

mark->
-- 
"Moral cowardice will surely be written as the cause on the death
certificate of what used to be Western Civilization." --James P. Hogan


More information about the Filepro-list mailing list