| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // Append the data to |fd|. Does not close |fd| when done. | 381 // Append the data to |fd|. Does not close |fd| when done. |
| 382 BASE_EXPORT int WriteFileDescriptor(const int fd, const char* data, int size); | 382 BASE_EXPORT int WriteFileDescriptor(const int fd, const char* data, int size); |
| 383 #endif | 383 #endif |
| 384 | 384 |
| 385 // Gets the current working directory for the process. | 385 // Gets the current working directory for the process. |
| 386 BASE_EXPORT bool GetCurrentDirectory(FilePath* path); | 386 BASE_EXPORT bool GetCurrentDirectory(FilePath* path); |
| 387 | 387 |
| 388 // Sets the current working directory for the process. | 388 // Sets the current working directory for the process. |
| 389 BASE_EXPORT bool SetCurrentDirectory(const FilePath& path); | 389 BASE_EXPORT bool SetCurrentDirectory(const FilePath& path); |
| 390 | 390 |
| 391 // Attempts to find a number that can be appended to the |path| to make it |
| 392 // unique. If |path| does not exist, 0 is returned. If it fails to find such |
| 393 // a number, -1 is returned. If |suffix| is not empty, also checks the |
| 394 // existence of it with the given suffix. |
| 395 BASE_EXPORT int GetUniquePathNumber(const FilePath& path, |
| 396 const FilePath::StringType& suffix); |
| 397 |
| 391 #if defined(OS_POSIX) | 398 #if defined(OS_POSIX) |
| 392 // Test that |path| can only be changed by a given user and members of | 399 // Test that |path| can only be changed by a given user and members of |
| 393 // a given set of groups. | 400 // a given set of groups. |
| 394 // Specifically, test that all parts of |path| under (and including) |base|: | 401 // Specifically, test that all parts of |path| under (and including) |base|: |
| 395 // * Exist. | 402 // * Exist. |
| 396 // * Are owned by a specific user. | 403 // * Are owned by a specific user. |
| 397 // * Are not writable by all users. | 404 // * Are not writable by all users. |
| 398 // * Are owned by a memeber of a given set of groups, or are not writable by | 405 // * Are owned by a memeber of a given set of groups, or are not writable by |
| 399 // their group. | 406 // their group. |
| 400 // * Are not symbolic links. | 407 // * Are not symbolic links. |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 645 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
| 639 #endif | 646 #endif |
| 640 | 647 |
| 641 } // namespace file_util | 648 } // namespace file_util |
| 642 | 649 |
| 643 // Deprecated functions have been moved to this separate header file, | 650 // Deprecated functions have been moved to this separate header file, |
| 644 // which must be included last after all the above definitions. | 651 // which must be included last after all the above definitions. |
| 645 #include "base/file_util_deprecated.h" | 652 #include "base/file_util_deprecated.h" |
| 646 | 653 |
| 647 #endif // BASE_FILE_UTIL_H_ | 654 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |