get_logical_drives
Definition: | sequence res = get_logical_drives() |
Description: | Returns a list of {string drive, integer drivetype} pairs. |
pwa/p2js: | Not supported. |
Comments: |
The following drivetypes are pre-defined in psym.e:
global constant DRIVE_UNKNOWN = 0, -- The drive type cannot be determined. DRIVE_NO_ROOT_DIR = 1, -- The root path is invalid; eg no volume mounted. DRIVE_REMOVABLE = 2, -- removable media; eg a floppy, thumb, or flash card. DRIVE_FIXED = 3, -- fixed media; eg a hard disk or flash drive. DRIVE_REMOTE = 4, -- a remote (network) drive. DRIVE_CDROM = 5, -- a CD-ROM drive. DRIVE_RAMDISK = 6 -- a RAM disk. On Windows, wraps the kernel32 function GetLogicalDriveStrings (rather than GetLogicalDrives which returns a bitmask) and GetDriveType. On Linux, simply returns {{"/",DRIVE_FIXED}}. |
Example: |
?get_logical_drives() -- prints eg {{`C:\`,3},{`D:\`,5},{`E:\`,3},{`F:\`,6},{`G:\`,2}} -- (where 3/5/3/6/2 are DRIVE_FIXED/CDROM/FIXED/RAMDISK/REMOVABLE) |
Implementation: | The implementation of this routine can be found in builtins\pfile.e (an autoinclude) - and is open to suggestions for enhancement. |
See Also: | dir |