| 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 "bin/file.h" | 5 #include "bin/file.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 int fd = open(name, flags, 0666); | 107 int fd = open(name, flags, 0666); |
| 108 if (fd < 0) { | 108 if (fd < 0) { |
| 109 return NULL; | 109 return NULL; |
| 110 } | 110 } |
| 111 if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) { | 111 if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) { |
| 112 int position = lseek(fd, 0, SEEK_END); | 112 int position = lseek(fd, 0, SEEK_END); |
| 113 if (position < 0) { | 113 if (position < 0) { |
| 114 return NULL; | 114 return NULL; |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 return new File(name, new FileHandle(fd)); | 117 return new File(new FileHandle(fd)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 File* File::OpenStdio(int fd) { | 121 File* File::OpenStdio(int fd) { |
| 122 UNREACHABLE(); | 122 UNREACHABLE(); |
| 123 return NULL; | 123 return NULL; |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 bool File::Exists(const char* name) { | 127 bool File::Exists(const char* name) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 const char* File::StringEscapedPathSeparator() { | 225 const char* File::StringEscapedPathSeparator() { |
| 226 return "\\\\"; | 226 return "\\\\"; |
| 227 } | 227 } |
| 228 | 228 |
| 229 | 229 |
| 230 File::StdioHandleType File::GetStdioHandleType(int fd) { | 230 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 231 // Treat all stdio handles as pipes. The Windows event handler and | 231 // Treat all stdio handles as pipes. The Windows event handler and |
| 232 // socket code will handle the different handle types. | 232 // socket code will handle the different handle types. |
| 233 return kPipe; | 233 return kPipe; |
| 234 } | 234 } |
| OLD | NEW |