aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-03-22 11:55:34 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-22 12:00:42 -0700
commit6ed3cec4ae1a0706abf3c7b82f6b70f6a45a760c (patch)
tree4fe5673c3fbc5c87ab1833d4cd9822b2f63904d1
parentebf8abdb4db1f4224ba61cd1d478e5301ff4bfd7 (diff)
Make GetLocalTemporaryDirectories() a virtual method of Env, that is overriden
by the implementations. PiperOrigin-RevId: 190102851
-rw-r--r--tensorflow/core/platform/env.h8
-rw-r--r--tensorflow/core/platform/posix/env.cc5
-rw-r--r--tensorflow/core/platform/windows/env.cc4
3 files changed, 13 insertions, 4 deletions
diff --git a/tensorflow/core/platform/env.h b/tensorflow/core/platform/env.h
index 2a114d47a8..a7e9fcb17c 100644
--- a/tensorflow/core/platform/env.h
+++ b/tensorflow/core/platform/env.h
@@ -291,10 +291,10 @@ class Env {
virtual string FormatLibraryFileName(const string& name,
const string& version) = 0;
- private:
// Returns a possible list of local temporary directories.
- void GetLocalTempDirectories(std::vector<string>* list);
+ virtual void GetLocalTempDirectories(std::vector<string>* list) = 0;
+ private:
std::unique_ptr<FileSystemRegistry> file_system_registry_;
TF_DISALLOW_COPY_AND_ASSIGN(Env);
EnvTime* envTime = EnvTime::Default();
@@ -358,6 +358,10 @@ class EnvWrapper : public Env {
}
private:
+ void GetLocalTempDirectories(std::vector<string>* list) override {
+ target_->GetLocalTempDirectories(list);
+ }
+
Env* target_;
};
diff --git a/tensorflow/core/platform/posix/env.cc b/tensorflow/core/platform/posix/env.cc
index 8097624e09..418874d340 100644
--- a/tensorflow/core/platform/posix/env.cc
+++ b/tensorflow/core/platform/posix/env.cc
@@ -118,6 +118,9 @@ class PosixEnv : public Env {
const string& version) override {
return tensorflow::internal::FormatLibraryFileName(name, version);
}
+
+ private:
+ void GetLocalTempDirectories(std::vector<string>* list) override;
};
} // namespace
@@ -131,7 +134,7 @@ Env* Env::Default() {
}
#endif
-void Env::GetLocalTempDirectories(std::vector<string>* list) {
+void PosixEnv::GetLocalTempDirectories(std::vector<string>* list) {
list->clear();
// Directories, in order of preference. If we find a dir that
// exists, we stop adding other less-preferred dirs
diff --git a/tensorflow/core/platform/windows/env.cc b/tensorflow/core/platform/windows/env.cc
index 41b2644170..2f54f423b2 100644
--- a/tensorflow/core/platform/windows/env.cc
+++ b/tensorflow/core/platform/windows/env.cc
@@ -160,6 +160,8 @@ class WindowsEnv : public Env {
}
private:
+ void GetLocalTempDirectories(std::vector<string>* list) override;
+
typedef VOID(WINAPI* FnGetSystemTimePreciseAsFileTime)(LPFILETIME);
FnGetSystemTimePreciseAsFileTime GetSystemTimePreciseAsFileTime_;
};
@@ -174,7 +176,7 @@ Env* Env::Default() {
return default_env;
}
-void Env::GetLocalTempDirectories(std::vector<string>* list) {
+void WindowsEnv::GetLocalTempDirectories(std::vector<string>* list) {
list->clear();
// On windows we'll try to find a directory in this order:
// C:/Documents & Settings/whomever/TEMP (or whatever GetTempPath() is)