| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkOSFile.h" | 8 #include "SkOSFile.h" |
| 9 | 9 |
| 10 #include "SkTFitsIn.h" | |
| 11 #include "SkTypes.h" | |
| 12 | |
| 13 #include <dirent.h> | 10 #include <dirent.h> |
| 14 #include <stdio.h> | 11 #include <stdio.h> |
| 12 #include <string.h> |
| 15 #include <sys/mman.h> | 13 #include <sys/mman.h> |
| 16 #include <sys/stat.h> | 14 #include <sys/stat.h> |
| 17 #include <sys/types.h> | 15 #include <sys/types.h> |
| 18 #include <unistd.h> | 16 #include <unistd.h> |
| 19 | 17 |
| 18 #include "SkString.h" |
| 19 #include "SkTFitsIn.h" |
| 20 #include "SkTemplates.h" |
| 21 #include "SkTypes.h" |
| 22 |
| 20 bool sk_exists(const char *path, SkFILE_Flags flags) { | 23 bool sk_exists(const char *path, SkFILE_Flags flags) { |
| 21 int mode = F_OK; | 24 int mode = F_OK; |
| 22 if (flags & kRead_SkFILE_Flag) { | 25 if (flags & kRead_SkFILE_Flag) { |
| 23 mode |= R_OK; | 26 mode |= R_OK; |
| 24 } | 27 } |
| 25 if (flags & kWrite_SkFILE_Flag) { | 28 if (flags & kWrite_SkFILE_Flag) { |
| 26 mode |= W_OK; | 29 mode |= W_OK; |
| 27 } | 30 } |
| 28 return (0 == access(path, mode)); | 31 return (0 == access(path, mode)); |
| 29 } | 32 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 175 } |
| 173 if (entry) { // we broke out with a file | 176 if (entry) { // we broke out with a file |
| 174 if (name) { | 177 if (name) { |
| 175 name->set(entry->d_name); | 178 name->set(entry->d_name); |
| 176 } | 179 } |
| 177 return true; | 180 return true; |
| 178 } | 181 } |
| 179 } | 182 } |
| 180 return false; | 183 return false; |
| 181 } | 184 } |
| OLD | NEW |