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

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

Issue 12533008: dart:io | Add FileSystemEntity.typeSync to test for symbolic links. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add error-checking for arguments. Disable Windows implementation. 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
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return "\\\\"; 263 return "\\\\";
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
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;
Bob Nystrom 2013/03/06 19:02:52 What kind of symlinks does this detect? For what i
Bill Hesse 2013/03/07 09:53:12 The Windows implementation will report all types o
285 return File::kDoesNotExist;
286 }
287
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
273 #endif // defined(TARGET_OS_WINDOWS) 293 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698