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

Unified Diff: runtime/bin/file_win.cc

Issue 15832003: Change File.directory to not do any IO (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/io_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 31620032bfd19d98f3108aff276c04daeb0d25d5..d0f4c82c5bf4e2d20c294ed30024a68ead24062c 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -458,39 +458,6 @@ char* File::GetCanonicalPath(const char* pathname) {
}
-char* File::GetContainingDirectory(char* pathname) {
- struct _stat st;
- wchar_t* system_name = StringUtils::Utf8ToWide(pathname);
- int stat_status = _wstat(system_name, &st);
- if (stat_status == 0) {
- if ((st.st_mode & S_IFMT) != S_IFREG) {
- SetLastError(ERROR_FILE_NOT_FOUND);
- free(system_name);
- return NULL;
- }
- } else {
- SetLastError(ERROR_FILE_NOT_FOUND);
- free(system_name);
- return NULL;
- }
- int required_size = GetFullPathNameW(system_name, 0, NULL, NULL);
- wchar_t* path =
- static_cast<wchar_t*>(malloc(required_size * sizeof(wchar_t)));
- wchar_t* file_part = NULL;
- int written =
- GetFullPathNameW(system_name, required_size, path, &file_part);
- free(system_name);
- ASSERT(written == (required_size - 1));
- ASSERT(file_part != NULL);
- ASSERT(file_part > path);
- ASSERT(file_part[-1] == L'\\');
- file_part[-1] = '\0';
- char* result = StringUtils::WideToUtf8(path);
- free(path);
- return result;
-}
-
-
const char* File::PathSeparator() {
// This is already UTF-8 encoded.
return "\\";
« no previous file with comments | « runtime/bin/file_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698