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

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

Issue 10443008: Implement File.lastModified. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Return ms from C Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/socket_impl.dart » ('j') | 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 "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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 off_t File::LengthFromName(const char* name) { 157 off_t File::LengthFromName(const char* name) {
158 struct stat st; 158 struct stat st;
159 if (stat(name, &st) == 0) { 159 if (stat(name, &st) == 0) {
160 return st.st_size; 160 return st.st_size;
161 } 161 }
162 return -1; 162 return -1;
163 } 163 }
164 164
165 165
166 time_t File::LastModified(const char* name) {
167 struct stat st;
168 if (stat(name, &st) == 0) {
169 return st.st_mtime;
170 }
171 return -1;
172 }
173
174
166 bool File::IsAbsolutePath(const char* pathname) { 175 bool File::IsAbsolutePath(const char* pathname) {
167 // Should we consider network paths? 176 // Should we consider network paths?
168 if (pathname == NULL) return false; 177 if (pathname == NULL) return false;
169 return (strlen(pathname) > 2) && 178 return (strlen(pathname) > 2) &&
170 (pathname[1] == ':') && 179 (pathname[1] == ':') &&
171 (pathname[2] == '\\' || pathname[2] == '/'); 180 (pathname[2] == '\\' || pathname[2] == '/');
172 } 181 }
173 182
174 183
175 char* File::GetCanonicalPath(const char* pathname) { 184 char* File::GetCanonicalPath(const char* pathname) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 const char* File::StringEscapedPathSeparator() { 227 const char* File::StringEscapedPathSeparator() {
219 return "\\\\"; 228 return "\\\\";
220 } 229 }
221 230
222 231
223 File::StdioHandleType File::GetStdioHandleType(int fd) { 232 File::StdioHandleType File::GetStdioHandleType(int fd) {
224 // Treat all stdio handles as pipes. The Windows event handler and 233 // Treat all stdio handles as pipes. The Windows event handler and
225 // socket code will handle the different handle types. 234 // socket code will handle the different handle types.
226 return kPipe; 235 return kPipe;
227 } 236 }
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/socket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698