]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // directory_management.hpp --------------------------------------------------------------// |
2 | ||
3 | // Copyright 2010 Vicente J. Botet Escriba | |
4 | // Copyright 2015 Andrey Semashev | |
5 | ||
6 | // Distributed under the Boost Software License, Version 1.0. | |
7 | // See http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
9 | ||
10 | #ifndef BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP | |
11 | #define BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP | |
12 | ||
13 | #include <boost/detail/winapi/basic_types.hpp> | |
14 | #include <boost/detail/winapi/get_system_directory.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_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI | |
24 | CreateDirectoryA(boost::detail::winapi::LPCSTR_, ::_SECURITY_ATTRIBUTES*); | |
25 | BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI | |
26 | GetTempPathA(boost::detail::winapi::DWORD_ length, boost::detail::winapi::LPSTR_ buffer); | |
27 | BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI | |
28 | RemoveDirectoryA(boost::detail::winapi::LPCSTR_); | |
29 | #endif | |
30 | BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI | |
31 | CreateDirectoryW(boost::detail::winapi::LPCWSTR_, ::_SECURITY_ATTRIBUTES*); | |
32 | BOOST_SYMBOL_IMPORT boost::detail::winapi::DWORD_ WINAPI | |
33 | GetTempPathW(boost::detail::winapi::DWORD_ length, boost::detail::winapi::LPWSTR_ buffer); | |
34 | BOOST_SYMBOL_IMPORT boost::detail::winapi::BOOL_ WINAPI | |
35 | RemoveDirectoryW(boost::detail::winapi::LPCWSTR_); | |
36 | } | |
37 | #endif | |
38 | ||
39 | namespace boost { | |
40 | namespace detail { | |
41 | namespace winapi { | |
42 | ||
43 | #if !defined( BOOST_NO_ANSI_APIS ) | |
44 | using ::GetTempPathA; | |
45 | using ::RemoveDirectoryA; | |
46 | #endif | |
47 | using ::GetTempPathW; | |
48 | using ::RemoveDirectoryW; | |
49 | ||
50 | #if !defined( BOOST_NO_ANSI_APIS ) | |
51 | BOOST_FORCEINLINE BOOL_ CreateDirectoryA(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) | |
52 | { | |
53 | return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); | |
54 | } | |
55 | #endif | |
56 | ||
57 | BOOST_FORCEINLINE BOOL_ CreateDirectoryW(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) | |
58 | { | |
59 | return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); | |
60 | } | |
61 | ||
62 | #if !defined( BOOST_NO_ANSI_APIS ) | |
63 | BOOST_FORCEINLINE BOOL_ create_directory(LPCSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) | |
64 | { | |
65 | return ::CreateDirectoryA(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); | |
66 | } | |
67 | BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPSTR_ buffer) | |
68 | { | |
69 | return ::GetTempPathA(length, buffer); | |
70 | } | |
71 | BOOST_FORCEINLINE BOOL_ remove_directory(LPCSTR_ pPathName) | |
72 | { | |
73 | return ::RemoveDirectoryA(pPathName); | |
74 | } | |
75 | #endif | |
76 | ||
77 | BOOST_FORCEINLINE BOOL_ create_directory(LPCWSTR_ pPathName, PSECURITY_ATTRIBUTES_ pSecurityAttributes) | |
78 | { | |
79 | return ::CreateDirectoryW(pPathName, reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(pSecurityAttributes)); | |
80 | } | |
81 | BOOST_FORCEINLINE DWORD_ get_temp_path(DWORD_ length, LPWSTR_ buffer) | |
82 | { | |
83 | return ::GetTempPathW(length, buffer); | |
84 | } | |
85 | BOOST_FORCEINLINE BOOL_ remove_directory(LPCWSTR_ pPathName) | |
86 | { | |
87 | return ::RemoveDirectoryW(pPathName); | |
88 | } | |
89 | ||
90 | } // namespace winapi | |
91 | } // namespace detail | |
92 | } // namespace boost | |
93 | ||
94 | #endif // BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP |