OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
6 // filesystem. | 6 // filesystem. |
7 | 7 |
8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes); | 189 BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes); |
190 | 190 |
191 // Creates a symbolic link at |symlink| pointing to |target|. Returns | 191 // Creates a symbolic link at |symlink| pointing to |target|. Returns |
192 // false on failure. | 192 // false on failure. |
193 BASE_EXPORT bool CreateSymbolicLink(const FilePath& target, | 193 BASE_EXPORT bool CreateSymbolicLink(const FilePath& target, |
194 const FilePath& symlink); | 194 const FilePath& symlink); |
195 | 195 |
196 // Reads the given |symlink| and returns where it points to in |target|. | 196 // Reads the given |symlink| and returns where it points to in |target|. |
197 // Returns false upon failure. | 197 // Returns false upon failure. |
198 BASE_EXPORT bool ReadSymbolicLink(const FilePath& symlink, FilePath* target); | 198 BASE_EXPORT bool ReadSymbolicLink(const FilePath& symlink, FilePath* target); |
199 | |
200 // Read the permission of the given |path|. |mode| is file permission bits. | |
satorux1
2012/07/03 06:16:55
Read -> Reads
satorux1
2012/07/03 06:16:55
Please also mention about how symbolic links are h
yoshiki
2012/07/04 07:57:57
Done x2.
| |
201 BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, | |
202 mode_t* mode); | |
satorux1
2012/07/03 06:16:55
Not sure if using mode_t is a good idea. we might
yoshiki
2012/07/04 07:57:57
Done.
| |
203 // Change the permission of the given |path|. | |
satorux1
2012/07/03 06:16:55
Change -> Changes
yoshiki
2012/07/04 07:57:57
Done.
| |
204 BASE_EXPORT bool ChangePosixFilePermissions(const FilePath& path, | |
205 mode_t mode_bits_to_set, | |
206 mode_t mode_bits_to_clear); | |
satorux1
2012/07/03 06:16:55
I think taking two parameters for chaning the perm
yoshiki
2012/07/04 07:57:57
Done. I added another method SetPosixFilePermissio
| |
199 #endif // defined(OS_POSIX) | 207 #endif // defined(OS_POSIX) |
200 | 208 |
201 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
202 enum ShortcutOptions { | 210 enum ShortcutOptions { |
203 SHORTCUT_NO_OPTIONS = 0, | 211 SHORTCUT_NO_OPTIONS = 0, |
204 // Set DualMode property for Windows 8 Metro-enabled shortcuts. | 212 // Set DualMode property for Windows 8 Metro-enabled shortcuts. |
205 SHORTCUT_DUAL_MODE = 1 << 0, | 213 SHORTCUT_DUAL_MODE = 1 << 0, |
206 // Create a new shortcut (overwriting if necessary). If not specified, only | 214 // Create a new shortcut (overwriting if necessary). If not specified, only |
207 // non-null properties on an existing shortcut will be modified. | 215 // non-null properties on an existing shortcut will be modified. |
208 SHORTCUT_CREATE_ALWAYS = 1 << 1, | 216 SHORTCUT_CREATE_ALWAYS = 1 << 1, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 }; | 644 }; |
637 | 645 |
638 // Attempts determine the FileSystemType for |path|. | 646 // Attempts determine the FileSystemType for |path|. |
639 // Returns false if |path| doesn't exist. | 647 // Returns false if |path| doesn't exist. |
640 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 648 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
641 #endif | 649 #endif |
642 | 650 |
643 } // namespace file_util | 651 } // namespace file_util |
644 | 652 |
645 #endif // BASE_FILE_UTIL_H_ | 653 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |