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 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID | 8 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID |
9 # include <unistd.h> | 9 # include <unistd.h> |
10 # include <sys/time.h> | 10 # include <sys/time.h> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 DIR* dir = opendir(path); | 110 DIR* dir = opendir(path); |
111 if (NULL == dir) { | 111 if (NULL == dir) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 // Loop through dir entries until there are none left (i.e. readdir returns
NULL) | 115 // Loop through dir entries until there are none left (i.e. readdir returns
NULL) |
116 struct dirent* entry; | 116 struct dirent* entry; |
117 while ((entry = readdir(dir))) { | 117 while ((entry = readdir(dir))) { |
118 // dirent only gives relative paths, we need to join them to the base pa
th to check if they | 118 // dirent only gives relative paths, we need to join them to the base pa
th to check if they |
119 // are directories. | 119 // are directories. |
120 SkString joinedPath = SkOSPath::SkPathJoin(path, entry->d_name); | 120 SkString joinedPath = SkOSPath::Join(path, entry->d_name); |
121 | 121 |
122 // We only care about files | 122 // We only care about files |
123 if (!sk_isdir(joinedPath.c_str())) { | 123 if (!sk_isdir(joinedPath.c_str())) { |
124 entries->push_back(SkString(entry->d_name)); | 124 entries->push_back(SkString(entry->d_name)); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 closedir(dir); | 128 closedir(dir); |
129 | 129 |
130 return true; | 130 return true; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 #elif SK_BUILD_FOR_WIN32 | 197 #elif SK_BUILD_FOR_WIN32 |
198 SkString fullPath(MAX_PATH); | 198 SkString fullPath(MAX_PATH); |
199 if (_fullpath(fullPath.writable_str(), path.c_str(), MAX_PATH) == NULL) { | 199 if (_fullpath(fullPath.writable_str(), path.c_str(), MAX_PATH) == NULL) { |
200 fullPath.reset(); | 200 fullPath.reset(); |
201 } | 201 } |
202 return fullPath; | 202 return fullPath; |
203 #else | 203 #else |
204 return SkString(); | 204 return SkString(); |
205 #endif | 205 #endif |
206 } | 206 } |
OLD | NEW |