Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: <JUNCTION>; how to recognize

by pryrt (Abbot)
on Oct 10, 2018 at 21:08 UTC ( [id://1223830]=note: print w/replies, xml ) Need Help??


in reply to Re: <JUNCTION>; how to recognize
in thread <JUNCTION>; how to recognize

Following my link, and doing some more research, I eventually found https://github.com/dagolden/Path-Tiny/issues/160, which gave a function which spawns out to the cmd.exe DIR /AL command to find junctions and symlinks: so that could work. But it also pointed to Win32API::File, which has GetFileAttributes() and the FILE_ATTRIBUTE_REPARSE_POINT constant, which yields a solution for recognizing/identifying windows junctions:

use Win32API::File qw'GetFileAttributes :FILE_ATTRIBUTE_'; sub isjunc { return (GetFileAttributes($_[0]) & FILE_ATTRIBUTE_REPARSE_POINT == + FILE_ATTRIBUTE_REPARSE_POINT) ? 1 : 0; }

(I know, it could be simplified to sub isjunc { GetFileAttributes($_[0]) & FILE_ATTRIBUTE_REPARSE_POINT }, but I like making things more explicit.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-29 00:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found