• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2010 Vicente J. Botet Escriba
3  * Copyright 2015 Andrey Semashev
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * See http://www.boost.org/LICENSE_1_0.txt
7  */
8 
9 #ifndef BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_
10 #define BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_
11 
12 #include <boost/winapi/basic_types.hpp>
13 #include <boost/winapi/get_system_directory.hpp>
14 #include <boost/winapi/detail/header.hpp>
15 
16 #ifdef BOOST_HAS_PRAGMA_ONCE
17 #pragma once
18 #endif
19 
20 #if !defined( BOOST_USE_WINDOWS_H )
21 extern "C" {
22 #if !defined( BOOST_NO_ANSI_APIS )
23 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
24     CreateDirectoryA(boost::winapi::LPCSTR_, ::_SECURITY_ATTRIBUTES*);
25 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
26 BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
27     GetTempPathA(boost::winapi::DWORD_ length, boost::winapi::LPSTR_ buffer);
28 #endif
29 BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
30     RemoveDirectoryA(boost::winapi::LPCSTR_);
31 #endif
32 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
33     CreateDirectoryW(boost::winapi::LPCWSTR_, ::_SECURITY_ATTRIBUTES*);
34 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
35 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC
36     GetTempPathW(boost::winapi::DWORD_ length, boost::winapi::LPWSTR_ buffer);
37 #endif
38 BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC
39     RemoveDirectoryW(boost::winapi::LPCWSTR_);
40 } // extern "C"
41 #endif
42 
43 namespace boost {
44 namespace winapi {
45 
46 #if !defined( BOOST_NO_ANSI_APIS )
47 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
48 using ::GetTempPathA;
49 #endif
50 using ::RemoveDirectoryA;
51 #endif
52 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
53 using ::GetTempPathW;
54 #endif
55 using ::RemoveDirectoryW;
56 
57 #if !defined( BOOST_NO_ANSI_APIS )
CreateDirectoryA(LPCSTR_ pPathName,PSECURITY_ATTRIBUTES_ pSecurityAttributes)58 BOOST_FORCEINLINE BOOL_ CreateDirectoryA(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes)
59 {
60     return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes));
61 }
62 #endif
63 
CreateDirectoryW(LPCWSTR_ pPathName,PSECURITY_ATTRIBUTES_ pSecurityAttributes)64 BOOST_FORCEINLINE BOOL_ CreateDirectoryW(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes)
65 {
66     return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes));
67 }
68 
69 #if !defined( BOOST_NO_ANSI_APIS )
create_directory(LPCSTR_ pPathName,PSECURITY_ATTRIBUTES_ pSecurityAttributes)70 BOOST_FORCEINLINE BOOL_ create_directory(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes)
71 {
72     return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes));
73 }
74 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
get_temp_path(DWORD_ length,LPSTR_ buffer)75 BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPSTR_ buffer)
76 {
77     return ::GetTempPathA(length, buffer);
78 }
79 #endif
remove_directory(LPCSTR_ pPathName)80 BOOST_FORCEINLINE BOOL_ remove_directory(LPCSTR_ pPathName)
81 {
82     return ::RemoveDirectoryA(pPathName);
83 }
84 #endif
85 
create_directory(LPCWSTR_ pPathName,PSECURITY_ATTRIBUTES_ pSecurityAttributes)86 BOOST_FORCEINLINE BOOL_ create_directory(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes)
87 {
88     return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes));
89 }
90 #if BOOST_WINAPI_PARTITION_APP_SYSTEM
get_temp_path(DWORD_ length,LPWSTR_ buffer)91 BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPWSTR_ buffer)
92 {
93     return ::GetTempPathW(length, buffer);
94 }
95 #endif
remove_directory(LPCWSTR_ pPathName)96 BOOST_FORCEINLINE BOOL_ remove_directory(LPCWSTR_ pPathName)
97 {
98     return ::RemoveDirectoryW(pPathName);
99 }
100 
101 } // namespace winapi
102 } // namespace boost
103 
104 #include <boost/winapi/detail/footer.hpp>
105 
106 #endif // BOOST_WINAPI_DIRECTORY_MANAGEMENT_HPP_INCLUDED_
107