FAQ
On approximately 7/8/2005 11:40 PM, came the following characters from
the keyboard of demerphq:
On 7/9/05, Glenn Linderman wrote:

On approximately 7/8/2005 2:07 PM, came the following characters from
the keyboard of demerphq:

On 7/8/05, Michael G Schwern wrote:

On Fri, Jul 08, 2005 at 03:50:49PM +0200, demerphq wrote:

Im not sure if this is useful, but many of the things that File::Spec
tries to do on win32 are actually supported directly by the Win32 API.
IMO at least some of File::Spec's behaviour could take advantage of
this API.

Win32::GetFullPathName() is the one i have in mind when I say this.

perl -e "use Win32; print Win32::GetFullPathName(qq[foo\\..\\bar]);"

outputs "CWD\bar".

So if you strip off the CWD from the result of
Win32::GetFullPathName() you get the OS'es solution of this problem,
which should bypass all of these issues.
Does it? It still leaves us asking the question: can we assume foo\..\bar ==
bar on Windows? Just because a system call does it that way doesn't mean
its right.

Well, i suppose you are correct. Im not entirely sure what scenario I
should be testing here, but i beleive the problem you are thinking of
is due to symlinks to a directory? If so then the win32 equivelent
would be a junction I think and in that case yes, foo\..\bar == bar.

D:\dev\junct>junction foo

Junction v1.03 - Win2K junction creator and reparse point viewer
Copyright (C) 2000-2002 Mark Russinovich
Systems Internals - http://www.sysinternals.com

D:\dev\junct\foo: JUNCTION
Substitute Name: d:\dev\test

D:\dev\junct>echo Test1 > foo\..\test.echo

D:\dev\junct>type test.echo
Test1

D:\dev\junct>cd ..

D:\dev>echo test2 > test\..\test.echo

D:\dev>type test.echo
test2
OK, you have just proven that the file is the same whether accessed by
one name or the other. Now that you have the junction set up, how about
reporting on the results of:

d:
md \dev\junct\bar
cd \dev\junct
cd foo\..\bar
cd ..
cd foo
cd ..
cd \dev\test
cd foo\..\bar
cd ..
cd foo
cd ..

showing all the prompts that display the current path name in the sequence?

im not sure if your script exploited the structure i set up properly or not.

I had d:\dev\junct\foo -> d:\dev\test
Oops. No it probably doesn't. You used foo differently than in my
mental image, and then I confused myself by having two mental images of foo.

Although I think that in spite of my confusion, and the resulting
failure of some of the commands (which you tried to fix, thanks), that
the information I desired to obtain is demonstrated by the fragment of
your testing that I quote below...
so creating a directory in junct doesnt create it in test. Heres the
full output with me adding directories to resolve the "cant find
directory" errors. I ran the script you requested three times as
"junct.bat".

D:\dev>junction junct\foo

Junction v1.03 - Win2K junction creator and reparse point viewer
Copyright (C) 2000-2002 Mark Russinovich
Systems Internals - http://www.sysinternals.com

D:\dev\junct\foo: JUNCTION
Substitute Name: d:\dev\test


D:\dev>junct.bat

D:\dev>d:

D:\dev>md \dev\junct\bar

D:\dev>cd \dev\junct

D:\dev\junct>cd foo\..\bar

D:\dev\junct\bar>cd ..

D:\dev\junct>cd foo

D:\dev\junct\foo>cd ..

D:\dev\junct>cd \dev\test
At this point the prompt being D:\dev\junct indicates that the previous
"cd .." doesn't take one over to D:\dev\test. But, it appears that
CMD's CD command is likely looking at D:\dev\junct\foo and lexically
removing one path to return to .. rather than following the file system
.. entry to get there...

I guess there would be more interesting tests, perhaps a hybrid of what
you did, and what I was trying to do...

d:
cd \dev
echo a1 > junct\test.txt
echo b2 > test.txt
rem verify they are different files
type junct\test.txt
type test.txt
rem see which one we get
type junct\foo\..\test.txt

--
Glenn -- http://nevcal.com/
===========================
Having identified a vast realm of ignorance, Wolfram is saying that much
of this realm lies forever outside the light cone of human knowledge.
-- Michael Swaine, Dr Dobbs Journal, Sept 2002

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 17 of 19 | next ›
Discussion Overview
groupperl5-porters @
categoriesperl
postedJul 6, '05 at 9:00p
activeJul 12, '05 at 1:15a
posts19
users5
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase