ReactOS 0.4.17-dev-966-gf06eace
chdir.cpp File Reference
#include <direct.h>
#include <corecrt_internal_traits.h>
#include <corecrt_internal_win32_buffer.h>
#include <malloc.h>
#include <stdlib.h>
Include dependency graph for chdir.cpp:

Go to the source code of this file.

Functions

template<typename Character >
 _Success_ (return==0) static int __cdecl set_cwd_environment_variable(_In_z_ Character const *const path) throw ()
 
int __cdecl _chdir (char const *const path)
 
int __cdecl _wchdir (wchar_t const *const path)
 

Function Documentation

◆ _chdir()

int __cdecl _chdir ( char const *const  path)

Definition at line 101 of file chdir.cpp.

102{
103 return common_chdir(path);
104}

Referenced by chdir().

◆ _Success_()

template<typename Character >
_Success_ ( return  = = 0) const
throw (
)

Definition at line 34 of file chdir.cpp.

36{
37 typedef __crt_char_traits<Character> traits;
38
39 // If the path is a UNC name, no need to update:
40 if ((path[0] == '\\' || path[0] == '/') && path[0] == path[1])
41 return 0;
42
43#pragma warning(suppress:28931) // unused assignment of variable drive_letter
44 Character const drive_letter = static_cast<Character>(toupper(static_cast<char>(path[0])));
45 Character const name[] = { '=', drive_letter, ':', '\0' };
46
47 if (traits::set_environment_variable(name, path))
48 return 0;
49
51 return -1;
52}
void __cdecl __acrt_errno_map_os_error(unsigned long)
Definition: errno.cpp:91
int CDECL toupper(int c)
Definition: ctype.c:514
Definition: name.c:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ _wchdir()

int __cdecl _wchdir ( const wchar_t *  newdir)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the Wine project.

Definition at line 106 of file chdir.cpp.

107{
108 return common_chdir(path);
109}