Blitz3D+ Command Reference

CurrentDir$ ( )

Parameters

None.

Description

Returns the current directory.

This is the folder that relative paths in file commands are resolved against. It starts out as the folder your program was launched from (the folder containing your source file when running from the IDE) and moves when you call ChangeDir.

The returned path has no trailing slash, except at the root of a drive - remember that when you glue file names onto it.

A common pattern is to remember it at startup so a tool can wander off with ChangeDir and still find its way home.

See also: ChangeDir, ReadDir, SystemProperty.

Example

; CurrentDir Example
; ------------------

; CurrentDir$ returns the folder used for relative file operations
Print "Current directory: "+CurrentDir$()

; It follows ChangeDir around
CreateDir "demo_folder"
ChangeDir "demo_folder"
Print "Inside demo_folder: "+CurrentDir$()

ChangeDir ".."
Print "Back where we started: "+CurrentDir$()

; Clean up the demo folder
DeleteDir "demo_folder"
Print "Cleaned up demo_folder"

Print ""
Print "Press any key to close the example"
WaitKey

End

Index