xref: /reactos/sdk/lib/ucrt/filesystem/wrmdir.cpp (revision e3e520d1)
1 //
2 // wrmdir.cpp
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The _wrmdir() function, which removes a directory.
7 //
8 #include <corecrt_internal.h>
9 #include <direct.h>
10 
11 
12 
13 // Removes the directory specified by the path.  The directory must be empty, it
14 // must not be the current working directory, and it must not be the root of any
15 // drive.  Returns 0 on success; returns -1 and sets errno and _doserrno on
16 // failure.
17 extern "C" int __cdecl _wrmdir(wchar_t const* const path)
18 {
19     if (!RemoveDirectoryW(path))
20     {
21         __acrt_errno_map_os_error(GetLastError());
22         return -1;
23     }
24 
25     return 0;
26 }
27