/
filesystem.h
78 lines (72 loc) · 2.19 KB
/
filesystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#pragma once
#ifdef _MSC_VER
#include <filesystem>
namespace awfsnamespace = std::tr2::sys;
#else
// Experimental filesystem library is rare everywhere else, we have to resort to autoboost
#include <autoboost/filesystem/config.hpp>
#include <autoboost/filesystem/convenience.hpp>
#include <autoboost/filesystem/operations.hpp>
#include <autoboost/filesystem/path.hpp>
namespace awfsnamespace = autoboost::filesystem;
#endif
namespace std {
namespace filesystem {
#ifdef _MSC_VER
#if _MSC_VER >= 1900
using awfsnamespace::path;
#else
class path :
public awfsnamespace::wpath
{
public:
path(void) = default;
path(const string_type& _Str) :
awfsnamespace::wpath(_Str)
{}
path(const awfsnamespace::wpath& _Right) :
awfsnamespace::wpath(_Right)
{}
path(const path& _Right) :
awfsnamespace::wpath(_Right)
{}
path(const char* _Ptr) :
awfsnamespace::wpath(_Ptr, _Ptr + strlen(_Ptr))
{}
path(const wchar_t* _Ptr) :
awfsnamespace::wpath(_Ptr)
{}
basic_path& operator=(basic_path&& _Right) { return *(awfsnamespace::wpath*)this = std::move(_Right); }
basic_path& operator=(const string_type& _Str) { return *(awfsnamespace::wpath*)this = _Str; }
basic_path& operator=(const wchar_t* _Ptr) { return *(awfsnamespace::wpath*)this = _Ptr; }
path extension(void) const {
return{ awfsnamespace::wpath::extension() };
}
path filename(void) const {
return{ awfsnamespace::wpath::filename() };
}
};
#endif
#else
using path = awfsnamespace::wpath;
#endif
using awfsnamespace::create_directory;
using awfsnamespace::current_path;
using awfsnamespace::exists;
using awfsnamespace::is_directory;
using awfsnamespace::is_empty;
using awfsnamespace::remove;
using awfsnamespace::remove_all;
using awfsnamespace::rename;
#ifdef _MSC_VER
template<class _Path>
_Path canonical(const _Path& _Pval, const _Path& _Pbase = current_path<_Path>())
{
return awfsnamespace::complete(_Pval, _Pbase);
}
#else
using awfsnamespace::canonical;
#endif
}
}