| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 158 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 159 int status = _wremove(system_name); | 159 int status = _wremove(system_name); |
| 160 free(const_cast<wchar_t*>(system_name)); | 160 free(const_cast<wchar_t*>(system_name)); |
| 161 if (status == -1) { | 161 if (status == -1) { |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 return true; | 164 return true; |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 off_t File::LengthFromName(const char* name) { | 168 off_t File::LengthFromPath(const char* name) { |
| 169 struct _stat st; | 169 struct _stat st; |
| 170 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 170 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 171 int stat_status = _wstat(system_name, &st); | 171 int stat_status = _wstat(system_name, &st); |
| 172 free(const_cast<wchar_t*>(system_name)); | 172 free(const_cast<wchar_t*>(system_name)); |
| 173 if (stat_status == 0) { | 173 if (stat_status == 0) { |
| 174 return st.st_size; | 174 return st.st_size; |
| 175 } | 175 } |
| 176 return -1; | 176 return -1; |
| 177 } | 177 } |
| 178 | 178 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 File::StdioHandleType File::GetStdioHandleType(int fd) { | 267 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 268 // Treat all stdio handles as pipes. The Windows event handler and | 268 // Treat all stdio handles as pipes. The Windows event handler and |
| 269 // socket code will handle the different handle types. | 269 // socket code will handle the different handle types. |
| 270 return kPipe; | 270 return kPipe; |
| 271 } | 271 } |
| 272 | 272 |
| 273 #endif // defined(TARGET_OS_WINDOWS) | 273 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |