Click or drag to resize

CurDir Function

X#
Return the current Windows directory.

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

Return Value

Type: String
The current directory of the drive specified by cDrive, without either leading or trailing backslash (\) characters.
If an error occurs, or the current directory of the specified drive is the root directory, CurDir() returns a NULL_STRING. Please note that another Windows task might change the current directory of a non-default drive, thereby affecting the return value of CurDir() when it is used to query non-default drives.
Remarks
Examples
These examples illustrate various CurDir() results:
X#
1? CurDir("e:")        // NULL_STRING, root directory
2? CurDir("c")            // vo\source
3? CurDir("c:")            // vo\source
4? CurDir()            // NULL_STRING, root directory
5? CurDir("a")            // NULL_STRING, drive not ready
This example changes the current Windows directory to a new value if it does not match a specified directory:
X#
1IF CurDir("c:") != "vo\source"
2    DirChange("\vo\source")
3ENDIF
See Also