| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 147 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 148 int fd = _wopen(system_name, O_RDONLY | O_CREAT, 0666); | 148 int fd = _wopen(system_name, O_RDONLY | O_CREAT, 0666); |
| 149 free(const_cast<wchar_t*>(system_name)); | 149 free(const_cast<wchar_t*>(system_name)); |
| 150 if (fd < 0) { | 150 if (fd < 0) { |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 return (close(fd) == 0); | 153 return (close(fd) == 0); |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 bool File::CreateLink(const char* name, const char* target) { |
| 158 // TODO(whesse): Implement Junction creation. |
| 159 return false; |
| 160 } |
| 161 |
| 162 |
| 157 bool File::Delete(const char* name) { | 163 bool File::Delete(const char* name) { |
| 158 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 164 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 159 int status = _wremove(system_name); | 165 int status = _wremove(system_name); |
| 160 free(const_cast<wchar_t*>(system_name)); | 166 free(const_cast<wchar_t*>(system_name)); |
| 161 if (status == -1) { | 167 if (status == -1) { |
| 162 return false; | 168 return false; |
| 163 } | 169 } |
| 164 return true; | 170 return true; |
| 165 } | 171 } |
| 166 | 172 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 return File::kDoesNotExist; | 295 return File::kDoesNotExist; |
| 290 } | 296 } |
| 291 } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { | 297 } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { |
| 292 return File::kIsDirectory; | 298 return File::kIsDirectory; |
| 293 } else { | 299 } else { |
| 294 return File::kIsFile; | 300 return File::kIsFile; |
| 295 } | 301 } |
| 296 } | 302 } |
| 297 | 303 |
| 298 #endif // defined(TARGET_OS_WINDOWS) | 304 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |