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

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

Issue 9416096: Implement File.directory() and File.directorySync() to get (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implement async version using isolate Created 8 years, 10 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 "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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 char* File::GetCanonicalPath(const char* pathname) { 169 char* File::GetCanonicalPath(const char* pathname) {
170 int required_size = GetFullPathName(pathname, 0, NULL, NULL); 170 int required_size = GetFullPathName(pathname, 0, NULL, NULL);
171 char* path = static_cast<char*>(malloc(required_size)); 171 char* path = static_cast<char*>(malloc(required_size));
172 int written = GetFullPathName(pathname, required_size, path, NULL); 172 int written = GetFullPathName(pathname, required_size, path, NULL);
173 ASSERT(written == (required_size - 1)); 173 ASSERT(written == (required_size - 1));
174 return path; 174 return path;
175 } 175 }
176 176
177 177
178 char* File::GetContainingDirectory(char* pathname) {
179 ASSERT(Exists(pathname));
180 int required_size = GetFullPathName(pathname, 0, NULL, NULL);
181 char* path = static_cast<char*>(malloc(required_size));
182 char* file_part = NULL;
183 int written = GetFullPathName(pathname, required_size, path, &file_part);
184 ASSERT(written == (required_size - 1));
185 ASSERT(file_part != NULL);
186 ASSERT(file_part > path);
187 ASSERT(file_part[-1] == '\\');
188 file_part[-1] = '\0';
189 return path;
190 }
191
192
178 const char* File::PathSeparator() { 193 const char* File::PathSeparator() {
179 return "\\"; 194 return "\\";
180 } 195 }
181 196
182 197
183 const char* File::StringEscapedPathSeparator() { 198 const char* File::StringEscapedPathSeparator() {
184 return "\\\\"; 199 return "\\\\";
185 } 200 }
186 201
187 202
188 File::StdioHandleType File::GetStdioHandleType(int fd) { 203 File::StdioHandleType File::GetStdioHandleType(int fd) {
189 // Treat all stdio handles as pipes. The Windows event handler and 204 // Treat all stdio handles as pipes. The Windows event handler and
190 // socket code will handle the different handle types. 205 // socket code will handle the different handle types.
191 return kPipe; 206 return kPipe;
192 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698