Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: runtime/bin/file_win.cc

Issue 12464013: dart:io | Fix stray code committed to Windows platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 273
274 File::Type File::GetType(const char* pathname, bool follow_links) { 274 File::Type File::GetType(const char* pathname, bool follow_links) {
275 struct _stat entry_info;
276 const wchar_t* system_name = StringUtils::Utf8ToWide(pathname);
277 // TODO(whesse): We need to use FileGetAttributes here, and more complex
278 // checks.
279 int stat_success = _wstat(system_name, &st);
280 free(const_cast<wchar_t*>(system_name));
281 if (stat_success == -1) return File::kDoesNotExist;
282 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory;
283 if (S_ISREG(entry_info.st_mode)) return File::kIsFile;
284 // if (S_ISLNK(entry_info.st_mode)) return File::kIsLink;
285 return File::kDoesNotExist; 275 return File::kDoesNotExist;
286 } 276 }
287 277
288 struct _stat st;
289 const wchar_t* system_name = StringUtils::Utf8ToWide(name);
290 int stat_status = _wstat(system_name, &st);
291 free(const_cast<wchar_t*>(system_name));
292
293 #endif // defined(TARGET_OS_WINDOWS) 278 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698