> Le sam. 16 mai 2020 à 12:16, ToddAndMargo via perl6-users
> <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> a écrit :
>
> On 2020-05-15 22:30, ToddAndMargo via perl6-users wrote:
> > Hi All,.
> >
> > Windows 7, sp1, x64
> >
> > >raku -v
> > This is Rakudo version 2020.01 built on MoarVM version
> > 2020.01.1 implementing Perl 6.d.
> >
> >
> > I am trying to get perl to tell me if a drive letter exists
> >
> > This is from Git's df command:
> >
> > >df -kPT H:\
> > Filesystem Type 1024-blocks Used Available Capacity
Mounted on
> > H: ntfs 38908 9964 28944 26% /h
> >
> > So, H:\ is there
> >
> > >raku "say H:\.IO.e"
> > Could not open say H:\.IO.e. Failed to stat file: no such file or
> directory
> >
> > And in case I need \\
> >
> > >raku "say H:\\.IO.e"
> > Could not open say H:\\.IO.e. Failed to stat file: no such file or
> > directory
> >
> > And in case I need a forward slashL:
> > >raku "say H:/.IO.e"
> > Could not open say H:/.IO.e. Failed to stat file: no such file or
> directory
> >
> > What am I doing wrong, this time?
> >
> > -T
> >
>
>
> As far as I can tell IO.e and IO.d is completely trashed
> in Windows:
>
> K:\Windows\NtUtil>dir H:
> Volume in drive H is BACKUP
> Volume Serial Number is 00D0-CAD4
>
> Directory of H:\
>
> 05/15/2020 22:21 0 IAmBackup
> 05/15/2020 22:43 <DIR> MyDocsBackup
> 1 File(s) 0 bytes
> 1 Dir(s) 29,638,656 bytes free
>
>
>
> K:\Windows\NtUtil>raku "say 'h://IAmBackup'.IO.e"
> Could not open say 'h://IAmBackup'.IO.e. Failed to stat file: no such
> file or di
> rectory
>
> K:\Windows\NtUtil>raku "say 'h:/IAmBackup'.IO.e"
> Could not open say 'h:/IAmBackup'.IO.e. Failed to stat file: no such
> file or directory
>
> K:\Windows\NtUtil>raku "say 'h:\IAmBackup'.IO.e"
> Could not open say 'h:\IAmBackup'.IO.e. Failed to stat file: no such
> file or directory
>
> K:\Windows\NtUtil>raku "say 'h:\\IAmBackup'.IO.e"
> Could not open say 'h:\\IAmBackup'.IO.e. Failed to stat file: no such
> file or directory
>
>
> And that goes for IO.d too:
>
> K:\Windows\NtUtil>raku "say 'h:\\MyDocsBackup'.IO.d"
> Could not open say 'h:\\MyDocsBackup'.IO.d. Failed to stat file: no
> such
> file or
> directory
>
> K:\Windows\NtUtil>raku "say 'h:\MyDocsBackup'.IO.d"
> Could not open say 'h:\MyDocsBackup'.IO.d. Failed to stat file:
no such
> file or directory
>
> K:\Windows\NtUtil>raku "say 'h:/MyDocsBackup'.IO.d"
> Could not open say 'h:/MyDocsBackup'.IO.d. Failed to stat file:
no such
> file or directory
>
> K:\Windows\NtUtil>raku "say 'h://MyDocsBackup'.IO.d"
> Could not open say 'h://MyDocsBackup'.IO.d. Failed to stat file: no
> such
> file or directory
>
> This gets a TRIPLE: :'( :'( :'(
>
>
>
> And it only works slightly better under Fedora:
>
> $ p6 'say "GetOptLongTest.pl6".IO.e'
> True
>
> $ p6 'say "GetOptLongTest.pl7".IO.e'
> False
>
> $ p6 'say "p6lib".IO.d'
> True
>
> $ p6 'say "p7lib".IO.d'
> Failed to find '/home/linuxutil/p7lib' while trying to do '.d'
> in block <unit> at -e line 1
>
> Notice that it crashed instead of returning a False.
>
> This gets a single :'(
>
> <editorial comment> AAAAAAHHHHHH!!!! </editorial comment>
> On 2020-05-16 04:29, Laurent Rosenfeld via perl6-users wrote:
Hi,
it should be:
$ raku *-e* "your one-liner script here"
Best regards,
Laurent.
Hi Laurent,
Excuse me a minute whilst I wipe some egg off my face.
mumble, mumble, mumble
Now it works
K:\Windows\NtUtil>raku -e "say 'h:/IAmBackup'.IO.e"
True
K:\Windows\NtUtil>raku -e "say 'h:/IAmNotBackup'.IO.e"
False
K:\Windows\NtUtil>raku -e "say 'h:\IAmBackup'.IO.e"
True
K:\Windows\NtUtil>raku -e "say 'h:\IAmNotBackup'.IO.e"
False
And `.d` is working better too:
K:\Windows\NtUtil>raku -e "say 'h:/MyDocsBackup'.IO.d"
True
K:\Windows\NtUtil>raku -e "say 'h:/NotMyDocsBackup'.IO.d"
Failed to find 'H:\NotMyDocsBackup' while trying to do '.d'
in block <unit> at -e line 1
But crashing instead of giving a False makes .d worthless.
Oh but .e works on directyories too:
K:\Windows\NtUtil>raku -e "say 'h:/NotMyDocsBackup'.IO.e"
False
K:\Windows\NtUtil>raku -e "say 'h:/MyDocsBackup'.IO.e"
True
so a workaround
And .d will work if you tack a Bool at the end:
K:\Windows\NtUtil>raku -e "say 'h:/NotMyDocsBackup'.IO.d.Bool"
False
K:\Windows\NtUtil>raku -e "say 'h:/MyDocsBackup'.IO.d.Bool"
True
Thank you for the second pair of eyes!
-T
it is way more fun when I am not the one at fault