Click or drag to resize

SetDefault Function

X#
Change the setting that determines the X# default drive and directory.

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

Return Value

Type: String
Remarks
By default, when a X# program starts, the default drive and directory are the current X# drive and directory. Within the program, you can change this with SetDefault() — it sets the drive and directory where the application program creates and searches for files specified without a path name. Note: Certain commands and functions that open files do not respect the SetDefault() setting.
These cases are noted explicitly in the documentation for those commands and functions. SetDefault() does not change the X# drive and directory, but instead causes the application to use a different default.
To set additional search paths for file access, use SetPath().
Examples
This example uses SetDefault() to set and query the current default drive and directory:
X#
1FUNCTION Start()
2? GetCurPath()            // Print current path
3SetPath("c:\")            // Set new path
4? GetCurPath()            // Print current path
5? GetDefault()            // Print current default
6SetDefault("c:\")        // Set new default
7? GetDefault()            // Print current default
8WAIT
See Also