diff options
author | Jonathan Hseu <jhseu@google.com> | 2016-11-04 11:53:50 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-11-04 13:05:51 -0700 |
commit | 879e0accd1c833771c8058d3eb5f2d4f06f895d4 (patch) | |
tree | 81635e1bd758cd8a8e5ec760db70fc72f6480c66 /tensorflow/core/platform/file_system.h | |
parent | a2c8e99777cc0b961fb42106af5bd527a43e76f7 (diff) |
Change FileExists to return tensorflow::Status.
Also done separately by @llhe at github.com/tensorflow/tensorflow/pull/5370. We needed to do this change internally to fix all callers.
Motivation: The existing FileExists interface doesn't allow callers to distinguish between file not found vs. filesystem errors.
Semantics changes:
- gfile.Exists in Python now throws an exception for filesystem errors. It continues to return true/false if it can accurately determine whether a file exists.
- RecursivelyCreateDir now returns errors for filesystem errors when calling FileExists.
Change: 138224013
Diffstat (limited to 'tensorflow/core/platform/file_system.h')
-rw-r--r-- | tensorflow/core/platform/file_system.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tensorflow/core/platform/file_system.h b/tensorflow/core/platform/file_system.h index dfaf75be66..78453c4f72 100644 --- a/tensorflow/core/platform/file_system.h +++ b/tensorflow/core/platform/file_system.h @@ -61,7 +61,7 @@ class FileSystem { virtual Status NewReadOnlyMemoryRegionFromFile( const string& fname, std::unique_ptr<ReadOnlyMemoryRegion>* result) = 0; - virtual bool FileExists(const string& fname) = 0; + virtual Status FileExists(const string& fname) = 0; /// \brief Returns the immediate children in the given directory. /// @@ -178,7 +178,9 @@ class NullFileSystem : public FileSystem { "NewReadOnlyMemoryRegionFromFile unimplemented"); } - bool FileExists(const string& fname) override { return false; } + Status FileExists(const string& fname) override { + return errors::Unimplemented("FileExists unimplemented"); + } Status GetChildren(const string& dir, std::vector<string>* result) override { return errors::Unimplemented("GetChildren unimplemented"); |