Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: How does compare the relationship between two file system paths in a portable way?

by JavaFan (Canon)
on Aug 17, 2009 at 23:43 UTC ( [id://789306]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How does compare the relationship between two file system paths in a portable way?
in thread How does one compare the relationship between two file system paths in a portable way?

As long as you remember to do a readlink on all segments of the path, then it may work. As long as there aren't any loops. Loops can make two paths be parents of each other. Note however that it's not forbidden for a Unix filesystem to allow directory *hard*links. Not sure if Perl runs on any system that has a filesystem where that is allowed.

As for detecting mounts, stat tells you the device number of a file or directory. I don't know how to get, from Perl and in a portable way, a list of mount points.

  • Comment on Re^3: How does compare the relationship between two file system paths in a portable way?

Replies are listed 'Best First'.
Re^4: How does compare the relationship between two file system paths in a portable way?
by quester (Vicar) on Aug 18, 2009 at 04:29 UTC
    Note however that it's not forbidden for a Unix filesystem to allow directory *hard*links. Not sure if Perl runs on any system that has a filesystem where that is allowed.

    You can run Perl on Cygwin. A standard Cygwin installation will always have the equivalent of at least one hardlink.

    Usually the Windows directory that stores the Cygwin root directory will be in the default location C:\cygwin. Under Cygwin, that is mounted as /, but it can also be accessed as /cygdrive/c/cygwin. Both the drive leter (c) and directory name (cygwin) can be changed during installation.
      Note that I didn't just say "hardlinks". I said "directory hardlinks". That is:
      $ mkdir One $ ln -d One Two
      Cygwin allows that?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://789306]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found