Windows Drive Substitution


PLBWIN, 9.6

The PLB Windows runtimes allow a drive specification in all PLB filenames to be substituted with a user assigned string. This support is implemented as a straight string for string substitution where the runtime does not interpret or format the filename string as the substitution is performed. However, after the substitution is performed, a double path delimiter string (ie "\\") is replaced with a single path delimiter (ie "\").

 

The drive substitution is enabled by including a new section named [SubstDrives] in the runtime '.ini' configuration file. The [SubstDrives] includes any MSDOS drive specifications to be substituted as PLB instructions process the filename.

 

The following drive substitution assignments are all valid:

 

[SubstDrives]

l:=q:

m:=r:\mydir\

x:=\\computername\share\

y:=\\computername\share\somedir\

Example:

 

X

FILE

 

.

. Drive substitution to change drive letter only

.

 

 

 

OPEN

X, "l:\somedir\datafile.txt" ->Opens "q:\somedir\datafile.txt"

.

. Drive substitution to redirect to a UNC share format

.

 

 

 

OPEN

 X, "x:filename.txt"" ->Opens "\\computername\share\filename.txt"t"

.

. Drive substitution to redirect to a UNC share format

.

 

 

 

OPEN

X, "m:\datadir\datafile.txt" ->Opens "r:\mydir\datadir\datafile.txt"

Note the following:

  1.  The drive substitution is supported for the PATH instruction using the CHANGE, CREATE, CURRENT, DELETE, and EXIST keywords.

  2. When using the UNC naming convention, the Windows can only identify and maintain one current working directory unlike the DOS drive directory mapping. Therefore, when a UNC name is used for a PATH CHANGE keyword, only the current working directory for the runtime process can be changed. Using the UNC naming convention, there is no directory mapping history maintained by the Windows like the DOS drive mapping history.

  3. By default, the instructions GETFILE, PATH CURRENT, and FINDFILE have been implemented to return the mapped drive letter when the UNC name matches one of the mapped drives.

  4. A new keyword named 'PLB_RETURNUNCNAME={1|0}' has been added. This keyword can be added to the [SubstDrives] section to set the default path format to be used when returning path information for the GETFILE, PATH CURRENT, and FINDFILE instructions. If this keyword is not used, the default action is to return path information using the drive letter format. If this keyword is specified with a value of 1, the affected instructions return the path information using the UNC naming format. Otherwise, the path information is returned using a drive letter format. Note that the 'PLB_RETURNUNCNAME={1|0}' keyword must be placed in the [SubstDrives] section of the runtime INI file to take affect. This keyword only takes affect when the [SubstDrives] section is being used.

  5. The GETMODE and SETMODE instructions have been modified to support a keyword named 'PLB_RETURNUNCNAME={dnumnvar}'. This keyword is available to inquire and modify the default behavior for the GETFILE, PATH CURRENT, and FINDFILE instructions as described for the 'PLB_RETURNUNCNAME' runtime keyword.

 

 

See Also: Disk I/O Instructions

 



PL/B Language Reference SQLITE Tips BTRIEVE