diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 19:30:27 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 19:30:27 +0000 |
commit | ed65fece343181e91b4d36e161434cc763475de7 (patch) | |
tree | 27af7d7cb8a12f65b24dba3ebd5ede3d592e2d8e /base/platform_file.h | |
parent | 2d723bc66e60bedd617ebd464996ee2388c0c365 (diff) | |
download | chromium_src-ed65fece343181e91b4d36e161434cc763475de7.zip chromium_src-ed65fece343181e91b4d36e161434cc763475de7.tar.gz chromium_src-ed65fece343181e91b4d36e161434cc763475de7.tar.bz2 |
Add an optional parameter to CreatePlatformFile() to report the type
of error that occured while trying to open/create a file.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3223007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file.h')
-rw-r--r-- | base/platform_file.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/base/platform_file.h b/base/platform_file.h index 0216c71..70ed0f1 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -37,22 +37,30 @@ enum PlatformFileFlags { PLATFORM_FILE_ASYNC = 256, PLATFORM_FILE_TEMPORARY = 512, // Used on Windows only PLATFORM_FILE_HIDDEN = 1024, // Used on Windows only - PLATFORM_FILE_DELETE_ON_CLOSE = 2048 + PLATFORM_FILE_DELETE_ON_CLOSE = 2048, + PLATFORM_FILE_TRUNCATE = 4096 }; -// TODO(dumi): add more specific error codes for CreatePlatformFile(). -// TODO(dumi): add more error codes as we add new methods to FileUtilProxy. -enum PlatformFileErrors { +enum PlatformFileError { PLATFORM_FILE_OK = 0, - PLATFORM_FILE_ERROR = -1 + PLATFORM_FILE_ERROR_FAILED = -1, + PLATFORM_FILE_ERROR_IN_USE = -2, + PLATFORM_FILE_ERROR_EXISTS = -3, + PLATFORM_FILE_ERROR_NOT_FOUND = -4, + PLATFORM_FILE_ERROR_ACCESS_DENIED = -5, + PLATFORM_FILE_ERROR_TOO_MANY_OPENED = -6, + PLATFORM_FILE_ERROR_NO_MEMORY = -7, + PLATFORM_FILE_ERROR_NO_SPACE = -7, + PLATFORM_FILE_ERROR_NOT_A_DIRECTORY = -9 }; // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and // |created| is provided, |created| will be set to true if the file was created -// or to false in case the file was just opened. +// or to false in case the file was just opened. |error_code| can be NULL. PlatformFile CreatePlatformFile(const FilePath& name, int flags, - bool* created); + bool* created, + PlatformFileError* error_code); // Deprecated. PlatformFile CreatePlatformFile(const std::wstring& name, int flags, |