| 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 | |
| 163 bool File::Delete(const char* name) { | 157 bool File::Delete(const char* name) { |
| 164 const wchar_t* system_name = StringUtils::Utf8ToWide(name); | 158 const wchar_t* system_name = StringUtils::Utf8ToWide(name); |
| 165 int status = _wremove(system_name); | 159 int status = _wremove(system_name); |
| 166 free(const_cast<wchar_t*>(system_name)); | 160 free(const_cast<wchar_t*>(system_name)); |
| 167 if (status == -1) { | 161 if (status == -1) { |
| 168 return false; | 162 return false; |
| 169 } | 163 } |
| 170 return true; | 164 return true; |
| 171 } | 165 } |
| 172 | 166 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 return File::kDoesNotExist; | 289 return File::kDoesNotExist; |
| 296 } | 290 } |
| 297 } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { | 291 } else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { |
| 298 return File::kIsDirectory; | 292 return File::kIsDirectory; |
| 299 } else { | 293 } else { |
| 300 return File::kIsFile; | 294 return File::kIsFile; |
| 301 } | 295 } |
| 302 } | 296 } |
| 303 | 297 |
| 304 #endif // defined(TARGET_OS_WINDOWS) | 298 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |