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

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

Issue 9189003: Move assert.h/assert.cc from runtime/vm to runtime/platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check for correct rebase Created 8 years, 11 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_linux.cc ('k') | runtime/bin/file_test.cc » ('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"
6
5 #include <errno.h> 7 #include <errno.h>
6 #include <fcntl.h> 8 #include <fcntl.h>
7 #include <sys/stat.h> 9 #include <sys/stat.h>
8 #include <unistd.h> 10 #include <unistd.h>
9 #include <libgen.h> 11 #include <libgen.h>
10 #include <limits.h> 12 #include <limits.h>
11 13
12 #include "bin/builtin.h" 14 #include "bin/builtin.h"
13 #include "bin/file.h"
14 15
15 class FileHandle { 16 class FileHandle {
16 public: 17 public:
17 explicit FileHandle(int fd) : fd_(fd) { } 18 explicit FileHandle(int fd) : fd_(fd) { }
18 ~FileHandle() { } 19 ~FileHandle() { }
19 int fd() const { return fd_; } 20 int fd() const { return fd_; }
20 void set_fd(int fd) { fd_ = fd; } 21 void set_fd(int fd) { fd_ = fd; }
21 22
22 private: 23 private:
23 int fd_; 24 int fd_;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (pathname != NULL) { 159 if (pathname != NULL) {
159 // On some older MacOs versions the default behaviour of realpath allocating 160 // On some older MacOs versions the default behaviour of realpath allocating
160 // space for the resolved_path when a NULL is passed in does not seem to 161 // space for the resolved_path when a NULL is passed in does not seem to
161 // work, so we explicitly allocate space. The caller is responsible for 162 // work, so we explicitly allocate space. The caller is responsible for
162 // freeing this space as in a regular realpath call. 163 // freeing this space as in a regular realpath call.
163 char* resolved_path = reinterpret_cast<char*>(malloc(PATH_MAX + 1)); 164 char* resolved_path = reinterpret_cast<char*>(malloc(PATH_MAX + 1));
164 ASSERT(resolved_path != NULL); 165 ASSERT(resolved_path != NULL);
165 do { 166 do {
166 abs_path = realpath(pathname, NULL); 167 abs_path = realpath(pathname, NULL);
167 } while (abs_path == NULL && errno == EINTR); 168 } while (abs_path == NULL && errno == EINTR);
168 assert(abs_path == NULL || IsAbsolutePath(abs_path)); 169 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path));
169 } 170 }
170 return abs_path; 171 return abs_path;
171 } 172 }
172 173
173 174
174 const char* File::PathSeparator() { 175 const char* File::PathSeparator() {
175 return "/"; 176 return "/";
176 } 177 }
177 178
178 179
179 const char* File::StringEscapedPathSeparator() { 180 const char* File::StringEscapedPathSeparator() {
180 return "/"; 181 return "/";
181 } 182 }
OLDNEW
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698