Click or drag to resize

SetPath Function (String)

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(
	cPathList AS STRING
) AS STRING
Request Example View Source

Parameters

cPathList
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.)

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