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

Unified Diff: src/ports/SkOSFile_stdio.cpp

Issue 384903002: Add file access modes to sk_exists. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« include/core/SkOSFile.h ('K') | « include/core/SkOSFile.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkOSFile_stdio.cpp
diff --git a/src/ports/SkOSFile_stdio.cpp b/src/ports/SkOSFile_stdio.cpp
index ad26c807c79e45a6b5e30b367e7eb4c6b62d551e..2fd89c5fe0ae831958a32bf4f3438c62be484065 100644
--- a/src/ports/SkOSFile_stdio.cpp
+++ b/src/ports/SkOSFile_stdio.cpp
@@ -123,11 +123,18 @@ void sk_fclose(SkFILE* f) {
::fclose((FILE*)f);
}
-bool sk_exists(const char *path) {
+bool sk_exists(const char *path, SkFILE_Flags flags) {
+ int mode = 0;
mtklein 2014/07/10 21:03:30 // F_OK ?
bungeman-skia 2014/07/10 21:50:07 Done.
+ if (flags & kRead_SkFILE_Flag) {
+ mode |= 4; //R_OK
+ }
+ if (flags & kWrite_SkFILE_Flag) {
+ mode |= 2; //W_OK
+ }
#ifdef _WIN32
- return (0 == _access(path, 0));
+ return (0 == _access(path, mode));
#else
- return (0 == access(path, 0));
+ return (0 == access(path, mode));
#endif
}
« include/core/SkOSFile.h ('K') | « include/core/SkOSFile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698