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

Side by Side Diff: runtime/bin/file.h

Issue 12850010: Add FileSystemEntity.identical, to test if two file system objects are the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve posix versions 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 #ifndef BIN_FILE_H_ 5 #ifndef BIN_FILE_H_
6 #define BIN_FILE_H_ 6 #define BIN_FILE_H_
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 25 matching lines...) Expand all
36 kDartAppend = 2 36 kDartAppend = 2
37 }; 37 };
38 38
39 enum Type { 39 enum Type {
40 kIsFile = 0, 40 kIsFile = 0,
41 kIsDirectory = 1, 41 kIsDirectory = 1,
42 kIsLink = 2, 42 kIsLink = 2,
43 kDoesNotExist = 3 43 kDoesNotExist = 3
44 }; 44 };
45 45
46 enum Identical {
47 kIdentical = 0,
48 kDifferent = 1,
49 kError = 2
50 };
51
46 enum StdioHandleType { 52 enum StdioHandleType {
47 kTerminal = 0, 53 kTerminal = 0,
48 kPipe = 1, 54 kPipe = 1,
49 kFile = 2, 55 kFile = 2,
50 kSocket = 3, 56 kSocket = 3,
51 kOther = -1 57 kOther = -1
52 }; 58 };
53 59
54 enum FileRequest { 60 enum FileRequest {
55 kExistsRequest = 0, 61 kExistsRequest = 0,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 static bool Delete(const char* path); 133 static bool Delete(const char* path);
128 static off_t LengthFromPath(const char* path); 134 static off_t LengthFromPath(const char* path);
129 static time_t LastModified(const char* path); 135 static time_t LastModified(const char* path);
130 static char* LinkTarget(const char* pathname); 136 static char* LinkTarget(const char* pathname);
131 static bool IsAbsolutePath(const char* path); 137 static bool IsAbsolutePath(const char* path);
132 static char* GetCanonicalPath(const char* path); 138 static char* GetCanonicalPath(const char* path);
133 static char* GetContainingDirectory(char* path); 139 static char* GetContainingDirectory(char* path);
134 static const char* PathSeparator(); 140 static const char* PathSeparator();
135 static const char* StringEscapedPathSeparator(); 141 static const char* StringEscapedPathSeparator();
136 static Type GetType(const char* path, bool follow_links); 142 static Type GetType(const char* path, bool follow_links);
143 static Identical AreIdentical(const char* file_1, const char* file_2);
137 static StdioHandleType GetStdioHandleType(int fd); 144 static StdioHandleType GetStdioHandleType(int fd);
138 145
139 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode); 146 static FileOpenMode DartModeToFileMode(DartFileOpenMode mode);
140 147
141 static Dart_Port GetServicePort(); 148 static Dart_Port GetServicePort();
142 149
143 private: 150 private:
144 explicit File(FileHandle* handle) : handle_(handle) { } 151 explicit File(FileHandle* handle) : handle_(handle) { }
145 void Close(); 152 void Close();
146 153
147 static const int kClosedFd = -1; 154 static const int kClosedFd = -1;
148 155
149 // FileHandle is an OS specific class which stores data about the file. 156 // FileHandle is an OS specific class which stores data about the file.
150 FileHandle* handle_; // OS specific handle for the file. 157 FileHandle* handle_; // OS specific handle for the file.
151 158
152 static NativeService file_service_; 159 static NativeService file_service_;
153 160
154 DISALLOW_COPY_AND_ASSIGN(File); 161 DISALLOW_COPY_AND_ASSIGN(File);
155 }; 162 };
156 163
157 #endif // BIN_FILE_H_ 164 #endif // BIN_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698