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

Side by Side Diff: bin/file_linux.cc

Issue 9614006: - Proper URI resolution when loading scripts from the standalone binary. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « bin/file.h ('k') | bin/file_macos.cc » ('j') | bin/main.cc » ('J')
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 <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 char* File::GetContainingDirectory(char* pathname) { 180 char* File::GetContainingDirectory(char* pathname) {
181 char* path = NULL; 181 char* path = NULL;
182 do { 182 do {
183 path = dirname(pathname); 183 path = dirname(pathname);
184 } while (path == NULL && errno == EINTR); 184 } while (path == NULL && errno == EINTR);
185 return GetCanonicalPath(path); 185 return GetCanonicalPath(path);
186 } 186 }
187 187
188 188
189 const char* File:GetWorkingDirectory() {
190 return getcwd(NULL, 0);
191 }
192
193
189 const char* File::PathSeparator() { 194 const char* File::PathSeparator() {
190 return "/"; 195 return "/";
191 } 196 }
192 197
193 198
194 const char* File::StringEscapedPathSeparator() { 199 const char* File::StringEscapedPathSeparator() {
195 return "/"; 200 return "/";
196 } 201 }
197 202
198 203
199 File::StdioHandleType File::GetStdioHandleType(int fd) { 204 File::StdioHandleType File::GetStdioHandleType(int fd) {
200 ASSERT(0 <= fd && fd <= 2); 205 ASSERT(0 <= fd && fd <= 2);
201 struct stat buf; 206 struct stat buf;
202 int result = fstat(fd, &buf); 207 int result = fstat(fd, &buf);
203 if (result == -1) { 208 if (result == -1) {
204 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); 209 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno));
205 } 210 }
206 if (S_ISCHR(buf.st_mode)) return kTerminal; 211 if (S_ISCHR(buf.st_mode)) return kTerminal;
207 if (S_ISFIFO(buf.st_mode)) return kPipe; 212 if (S_ISFIFO(buf.st_mode)) return kPipe;
208 if (S_ISSOCK(buf.st_mode)) return kSocket; 213 if (S_ISSOCK(buf.st_mode)) return kSocket;
209 if (S_ISREG(buf.st_mode)) return kFile; 214 if (S_ISREG(buf.st_mode)) return kFile;
210 return kOther; 215 return kOther;
211 } 216 }
OLDNEW
« no previous file with comments | « bin/file.h ('k') | bin/file_macos.cc » ('j') | bin/main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698