Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: <JUNCTION>; how to recognize

by pryrt (Prior)
on Oct 10, 2018 at 21:08 UTC ( #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
Node Status?
node history
Node Type: note [id://1223830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2019-11-14 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (80 votes). Check out past polls.

    Notices?