Get the current boot drive

[Autolink] Menu

 
/* ------------------------------------------------------------------ */
/* function: get the OS/2 boot drive                                  */
/*                                                                    */
/* call:     bootDrive = GetOS2BootDrive()                            */
/*                                                                    */
/* where:    -                                                        */
/*                                                                    */
/* returns:  the OS/2 boot drive                                      */
/*                                                                    */
/* note:                                                              */
/*                                                                    */
/* Note that there are functions to get the boot drive in many        */
/* REXX DLLs available, for example in the RXLANUTIL DLL or in the    */
/* new REXXUTIL DLL. introduced with Object-Oriented REXX             */
/*                                                                    */
GetOS2BootDrive: PROCEDURE expose (exposeList)

                    /* load the REXXUTIL functions                    */
  call rxFuncAdd "SysLoadFuncs", "REXXUTIL", "SysLoadFuncs"
  call SysLoadFuncs

                    /* install a local error handler                  */
  signal on Syntax name GetOS2BootDrive1

  boot_drive = ''
  boot_drive = SysBootDrive()

GetOS2BootDrive1:
                    /* if SysBootDrive() failed, boot_drive is still  */
                    /* empty                                          */
                    /* SysBootDrive() is only in the newer versions   */
                    /* of REXXUTIL!                                   */
  if boot_drive = '' then
  do
                    /* You should do further tests to ensure that     */
                    /* the result of this method is correct!          */
    parse upper value VALUE( "PATH",, prog.__env ) with "\OS2\SYSTEM" -2,
                        boot_drive +2
  end /* if boot_drive = '' then */

return boot_drive


[Back: Disk-, Directory- and File-Handling]
[Next: Check if a drive is ready]