Click or drag to resize

DirectorySetCurrentDirectory Method (String, PathFormat)

Sets the application's current working directory to the specified directory.

MSDN: Multithreaded applications and shared library code should not use the GetCurrentDirectory function and should avoid using relative path names. The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process, therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value.

This limitation also applies to the SetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread, for example parsing file names from the command line argument string in the main thread prior to creating any additional threads.

Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.

Namespace:  Alphaleonis.Win32.Filesystem
Assembly:  AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax
public static void SetCurrentDirectory(
	string path,
	PathFormat pathFormat
)

Parameters

path
Type: SystemString
The path to which the current working directory is set.
pathFormat
Type: Alphaleonis.Win32.FilesystemPathFormat
Indicates the format of the path parameter.
See Also