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

Unified Diff: base/file_util.h

Issue 10696069: Add the methods to change and get a posix file permission to file_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix Created 8 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
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.h
diff --git a/base/file_util.h b/base/file_util.h
index 53eefcc4de1f2a71bb316a44bf97240dd70052dc..e374fa17ee49bda1a83a78eacee618146933cbf1 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -196,6 +196,37 @@ BASE_EXPORT bool CreateSymbolicLink(const FilePath& target,
// Reads the given |symlink| and returns where it points to in |target|.
// Returns false upon failure.
BASE_EXPORT bool ReadSymbolicLink(const FilePath& symlink, FilePath* target);
+
+// Bits ans masks of the file permission.
+enum FilePermissionBits {
+ FILE_PERMISSION_MASK = 00777,
+ FILE_PERMISSION_USER_MASK = 00700,
+ FILE_PERMISSION_GROUP_MASK = 00070,
+ FILE_PERMISSION_OTHERS_MASK = 00007,
satorux1 2012/07/04 16:10:41 Not sure if thees masks are needed. maybe remove?
yoshiki 2012/07/09 23:44:11 These are used at file_util_unittest.cc. Keeping.
+
+ FILE_PERMISSION_READ_BY_USER = 00400,
satorux1 2012/07/04 16:10:41 Use sys/stat.h constants? FILE_PERMISSION_READ_BY_
yoshiki 2012/07/09 23:44:11 Done.
+ FILE_PERMISSION_WRITE_BY_USER = 00200,
+ FILE_PERMISSION_EXECUTE_BY_USER = 00100,
+ FILE_PERMISSION_READ_BY_GROUP = 00040,
+ FILE_PERMISSION_WRITE_BY_GROUP = 00020,
+ FILE_PERMISSION_EXECUTE_BY_GROUP = 00010,
+ FILE_PERMISSION_READ_BY_OTHERS = 00004,
+ FILE_PERMISSION_WRITE_BY_OTHERS = 00002,
+ FILE_PERMISSION_EXECUTE_BY_OTHERS = 00001,
+};
+
+// Reads the permission of the given |path|, storing the file permission
+// bits in |mode|. If |path| is symbolic link, |mode| is the permission of
+// a file which the symlink refers to.
+BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path,
+ int* mode);
+// Sets the permission of the given |path|.
+BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path,
+ int mode);
+// Changes the permission of the given |path|.
+BASE_EXPORT bool ChangePosixFilePermissions(const FilePath& path,
+ int mode_bits_to_set,
+ int mode_bits_to_clear);
satorux1 2012/07/04 16:10:41 This function seems to be unnecessary as public AP
yoshiki 2012/07/09 23:44:11 Done.
#endif // defined(OS_POSIX)
#if defined(OS_WIN)
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698