Click or drag to resize

SetPath Function

X#
Change the setting that determines the X# search path for opening files.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION SetPath() AS STRING
Request Example View Source

Return Value

Type: String
Remarks
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.
Examples
This example sets two paths for opening files:
X#
1SetPath("a:\inventory;b:\vendors")
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:
X#
1SET VO_PATH = c:\apps\data;c:\apps\progs
Later in the configuration section of your application prograO:
X#
1SetPath(GetEnv("VO_PATH"))
See Also