| 1 | package Psh::Builtins::Drives; | ||
| 2 | |||
| 3 | require Psh::Util; | ||
| 4 | |||
| 5 | =item * C<drives> | ||
| 6 | |||
| 7 | Prints a list of the available drives on Windows or nothing on windows | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | |||
| 12 | sub bi_drives | ||
| 13 | { | ||
| 14 | if ($^O eq 'MSWin32') { | ||
| 15 | # I do not particularly like platform dependant code here | ||
| 16 | # On the other hand I also dislike filling the Psh::OS module | ||
| 17 | # with stuff for highly optional builtins | ||
| 18 | my @result=(); | ||
| 19 | eval "use Win32::NetAdmin;"; | ||
| 20 | Win32::NetAdmin::GetServerDisks("",\@result); | ||
| 21 | Psh::Util::print_out($_."\n") foreach @result; | ||
| 22 | } else { | ||
| 23 | } | ||
| 24 | return (1,undef); | ||
| 25 | } | ||
| 26 | |||
| 27 | 1; |