On 2/10/22 01:26, Elizabeth Mattijsen wrote:
So I was really hoping for a built in system32 call.
I really, really don't care for the the trouble
associated with using the "C" interface to call
system 32 dll's, but I may have to.

One of the things that Raku tries to do, is to be ignorant about the underlying 
OS.

Having a system32 DLL call built in, would be very Windows specific, would it 
not?

Yes it would. And it would sure beat the heck out of having to code NativeCall when you need specific information about
something in the OS.


A lot of Linux specific functionality lives in the ecosystem: 
https://raku.land/?q=Linux

Oddly enough a search for Win32 on raku.land yields:

   https://raku.land/github:ramiroencinas/Win32::DrivesAndTypes

Perhaps what you are looking for.  And something you should have been able to 
find with a little more work than just writing an email.


Liz

Hi Liz,

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!
-T

Reply via email to