home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / install / path.vrf < prev    next >
Encoding:
Text File  |  1994-12-30  |  2.3 KB  |  78 lines

  1. /* Copyright (c) Oracle Corporation 1993.  All Rights Reserved */
  2.  
  3. /*****************************************************************************
  4.   NAME
  5.     path.vrf - V3 common add-to-path script for Windows products
  6.  
  7.   DESCRIPTION
  8.     This script adds 'path_to_add' to the path variable in AUTOEXEC.BAT.
  9.     If the path becomes too long with the addition of 'path_to_add',
  10.     An information dialog is displayed.  Assuming there is no signal,
  11.     this script returns TRUE if the path was modified or FALSE if it wasn't
  12.     (i.e., if 'path_to_add' was already on the path).
  13.  
  14.   MODIFIED   MM/DD/YY REASON
  15.   dgalatin   12/17/93 Created.
  16. *****************************************************************************/
  17.  
  18. {
  19.   { evaluate("boot_drive"); }
  20.     [ 'UNBOUND_VARIABLE:
  21.       {
  22.        ui_action(identifying_boot_drive);
  23.  
  24.       if (earlier_version(dos_version(),"4"))
  25.           {
  26.               mapped_drives = dos_mapped_drives();
  27.  
  28.               extract(mapped_drives,"A"); extract(mapped_drives,"B");
  29.  
  30.             boot_drive = single_selection_dialog(boot_drive_prompt,
  31.                          mapped_drives,
  32.                          boot_drive_content,
  33.                          boot_drive_help);
  34.           }
  35.     else
  36.           boot_drive = dos_boot_drive();
  37.       }
  38.     ]
  39.  
  40.   path_variable = "SET PATH";
  41.   path_separator = " = ";
  42.   path_file = "%boot_drive%:\AUTOEXEC.BAT";
  43.  
  44.   if (not(exists(path_file)))
  45.     create_file(path_file);
  46.  
  47.   { { path_in_file = translate(path_variable,path_file,path_separator); }
  48.     [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  49.       { path_variable = "PATH";
  50.     { path_in_file = translate(path_variable,path_file,path_separator); }
  51.       [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  52.             { path_separator = " ";           
  53.           { path_in_file = translate(path_variable,path_file,
  54.                      path_separator); }
  55.             [ 'UNBOUND_ENVIRONMENT_VARIABLE:
  56.           { path_in_file = ""; continue(); } ] 
  57.         } ]
  58.     } ]
  59.   }
  60.  
  61.   exploded_path_in_file = explode(path_in_file,";");
  62.  
  63.   if (member(exploded_path_in_file,path_to_add))
  64.     return(FALSE);
  65.  
  66.   path_in_file = "%path_to_add%;%path_in_file%";
  67.  
  68.   len = length(path_in_file);
  69.   if (len > 127)
  70.     information_dialog(instantiate(path_too_long_prompt),
  71.                        path_too_long_content,
  72.                instantiate(path_too_long_help));
  73.  
  74.   modify(path_variable,path_in_file,path_file,path_separator);
  75.  
  76.   return(TRUE);
  77. }
  78.