OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include <fcntl.h> // NOLINT | 10 #include <fcntl.h> // NOLINT |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 switch (fd) { | 189 switch (fd) { |
190 case 1: | 190 case 1: |
191 fd = _fileno(stdout); | 191 fd = _fileno(stdout); |
192 break; | 192 break; |
193 case 2: | 193 case 2: |
194 fd = _fileno(stderr); | 194 fd = _fileno(stderr); |
195 break; | 195 break; |
196 default: | 196 default: |
197 UNREACHABLE(); | 197 UNREACHABLE(); |
198 } | 198 } |
| 199 _setmode(fd, _O_BINARY); |
199 return new File(new FileHandle(fd)); | 200 return new File(new FileHandle(fd)); |
200 } | 201 } |
201 | 202 |
202 | 203 |
203 bool File::Exists(const char* name) { | 204 bool File::Exists(const char* name) { |
204 struct __stat64 st; | 205 struct __stat64 st; |
205 const wchar_t* system_name = StringUtilsWin::Utf8ToWide(name); | 206 const wchar_t* system_name = StringUtilsWin::Utf8ToWide(name); |
206 bool stat_status = _wstat64(system_name, &st); | 207 bool stat_status = _wstat64(system_name, &st); |
207 free(const_cast<wchar_t*>(system_name)); | 208 free(const_cast<wchar_t*>(system_name)); |
208 if (stat_status == 0) { | 209 if (stat_status == 0) { |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 return kIdentical; | 692 return kIdentical; |
692 } else { | 693 } else { |
693 return kDifferent; | 694 return kDifferent; |
694 } | 695 } |
695 } | 696 } |
696 | 697 |
697 } // namespace bin | 698 } // namespace bin |
698 } // namespace dart | 699 } // namespace dart |
699 | 700 |
700 #endif // defined(TARGET_OS_WINDOWS) | 701 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |