1 | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 | // for details. All rights reserved. Use of this source code is governed by a |
3 | // BSD-style license that can be found in the LICENSE file. |
4 | |
5 | #include "platform/globals.h" |
6 | #if defined(HOST_OS_WINDOWS) |
7 | |
8 | #include "bin/namespace.h" |
9 | |
10 | #include <errno.h> |
11 | #include <sys/stat.h> |
12 | |
13 | #include "bin/utils.h" |
14 | #include "bin/utils_win.h" |
15 | |
16 | namespace dart { |
17 | namespace bin { |
18 | |
19 | Namespace* Namespace::Create(intptr_t namespc) { |
20 | return new Namespace(NULL); |
21 | } |
22 | |
23 | Namespace* Namespace::Create(const char* path) { |
24 | UNIMPLEMENTED(); |
25 | return NULL; |
26 | } |
27 | |
28 | Namespace::~Namespace() { |
29 | ASSERT(namespc_ == NULL); |
30 | } |
31 | |
32 | intptr_t Namespace::Default() { |
33 | return kNone; |
34 | } |
35 | |
36 | const char* Namespace::GetCurrent(Namespace* namespc) { |
37 | int length = GetCurrentDirectoryW(0, NULL); |
38 | if (length == 0) { |
39 | return NULL; |
40 | } |
41 | wchar_t* current; |
42 | current = reinterpret_cast<wchar_t*>( |
43 | Dart_ScopeAllocate((length + 1) * sizeof(*current))); |
44 | GetCurrentDirectoryW(length + 1, current); |
45 | return StringUtilsWin::WideToUtf8(current); |
46 | } |
47 | |
48 | bool Namespace::SetCurrent(Namespace* namespc, const char* path) { |
49 | Utf8ToWideScope system_path(path); |
50 | bool result = SetCurrentDirectoryW(system_path.wide()) != 0; |
51 | return result; |
52 | } |
53 | |
54 | void Namespace::ResolvePath(Namespace* namespc, |
55 | const char* path, |
56 | intptr_t* dirfd, |
57 | const char** resolved_path) { |
58 | UNIMPLEMENTED(); |
59 | } |
60 | |
61 | NamespaceScope::NamespaceScope(Namespace* namespc, const char* path) { |
62 | UNIMPLEMENTED(); |
63 | } |
64 | |
65 | NamespaceScope::~NamespaceScope() { |
66 | UNIMPLEMENTED(); |
67 | } |
68 | |
69 | } // namespace bin |
70 | } // namespace dart |
71 | |
72 | #endif // defined(HOST_OS_WINDOWS) |
73 | |