Functions.SetPath Method (String)
Change the setting that determines the X# search path for opening files.
XSharp.Core (in XSharp.Core.dll) Version: 2.16
Syntax Request Example
cPathList AS STRING
) AS STRING
public static string SetPath(
- Type: String
The paths X# uses when searching for a file not found in the default directory.
A path is a pointer to a directory.
It consists of an optional drive letter and colon, followed by a list of directories from the root to the desired directory separated by backslash (\) characters.
A path list is the sequence of paths to search, each separated by a comma or semicolon.
If omitted, the path list is released so that X# searches only the default directory. (Use GetCurPath() to get the current setting.)
SetPath() allows commands and functions that open database and associated files to find and open existing files in another drive and/or directory.
It does this by specifying a path list to search if a referenced file cannot be found in the default directory.
When you attempt to access a file without specifying its path, X# first searches the default drive and directory.
The default drive and directory are established by Windows when your application is loaded, or, during execution, by the SetDefault() function.
If the file is not found, X# then searches each path in the specified path list until the first occurrence of the file is found.
To create new files in another drive or directory, use SetDefault() or explicitly declare the path when specifying the new file name.
Note: Certain commands and functions that open files do not respect the SetPath() setting.
These cases are noted explicitly in the documentation for those commands and functions.
This example sets two paths for opening files:
This example configures a path setting at runtime by passing a DOS environment variable to a program, retrieving its value with GetEnv(), then setting the path with this value.
For example, in DOS:
1SET VO_PATH = c:\apps\data;c:\apps\progs
Later in the configuration section of your application prograO: