> On 10 Feb 2022, at 11:10, ToddAndMargo via perl6-users <perl6-users@perl.org> 
> wrote:
> That is an interesting module.  I am not sure what
> I would use it for though.  Maybe in the future.
> It is a method of find out what a drive is.
> 
> What I was after was finding the drive letter that
> corresponded to a logical volume label.   The drive
> letter will vary from computer to computer, so I
> did not want to hard code the drive letter.
> 
> >wmic logicaldisk get DeviceID,VolumeName
> 
> got me there.
> 
> 
> use WinMessageBox :MessageBox;
> use WinMount :ListLogicalVolumes;
> 
> sub GetDriveLetter()  {
>   # extract the drive letter in the format of "A:\" from logical volume name
> 
>   my $SubName = &?ROUTINE.name;
> 
>   for ListLogicalVolumes() -> $Volume  {
>      # print "$Volume\n";
>      if not $Volume<Label>  { next; }
> 
>      if $Volume<Label>.Str eq "Icedrive"  {
>          $IceDrive = $Volume<DriveLetter>.Str;
>          last;
>      } # if
>   }    # for
>   # print "Drive letter <" ~ $IceDrive ~ ">\n";
> 
>   if not $IceDrive  {
>       MessageBox( $IAm ~ ": " ~ $SubName, "Unable to locate Icedrive label", 
> MB_ICONERROR, MB_OK );
>   }
> 
>   return $IceDrive;
> }
> 
> 
> Thank you for the help!

This seems like functionality that could well live in the ecosystem.

Have you considered giving back to the community by putting this into a module 
(as well as the WinMessageBox and WinMount modules that it refers to, which I 
assume to be your private modules) and uploading it to the ecosystem?

Even if nobody else would use it, your future self will probably find it very 
useful!


Liz

Reply via email to