| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX | 167 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX |
| 168 // TODO Make sure this works on windows. This may require use of FindNextFil
e windows function. | 168 // TODO Make sure this works on windows. This may require use of FindNextFil
e windows function. |
| 169 glob_t globBuffer; | 169 glob_t globBuffer; |
| 170 if (glob(globPattern, 0, NULL, &globBuffer) != 0) { | 170 if (glob(globPattern, 0, NULL, &globBuffer) != 0) { |
| 171 return false; | 171 return false; |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Note these paths are in sorted order by default according to http://linux
.die.net/man/3/glob | 174 // Note these paths are in sorted order by default according to http://linux
.die.net/man/3/glob |
| 175 // Check under the flag GLOB_NOSORT | 175 // Check under the flag GLOB_NOSORT |
| 176 char** paths = globBuffer.gl_pathv; | 176 char** paths = globBuffer.gl_pathv; |
| 177 while(NULL != *paths) { | 177 while(*paths) { |
| 178 entries->push_back(SkString(*paths)); | 178 entries->push_back(SkString(*paths)); |
| 179 paths++; | 179 paths++; |
| 180 } | 180 } |
| 181 | 181 |
| 182 globfree(&globBuffer); | 182 globfree(&globBuffer); |
| 183 | 183 |
| 184 return true; | 184 return true; |
| 185 #else | 185 #else |
| 186 return false; | 186 return false; |
| 187 #endif | 187 #endif |
| 188 } | 188 } |
| 189 | 189 |
| 190 SkString get_absolute_path(const SkString& path) { | 190 SkString get_absolute_path(const SkString& path) { |
| 191 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID | 191 #if SK_BUILD_FOR_MAC || SK_BUILD_FOR_UNIX || SK_BUILD_FOR_ANDROID |
| 192 SkString fullPath(PATH_MAX + 1); | 192 SkString fullPath(PATH_MAX + 1); |
| 193 if (realpath(path.c_str(), fullPath.writable_str()) == NULL) { | 193 if (realpath(path.c_str(), fullPath.writable_str()) == NULL) { |
| 194 fullPath.reset(); | 194 fullPath.reset(); |
| 195 } | 195 } |
| 196 return fullPath; | 196 return fullPath; |
| 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 |