aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/platform/windows/windows_file_system.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/platform/windows/windows_file_system.cc')
-rw-r--r--tensorflow/core/platform/windows/windows_file_system.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/tensorflow/core/platform/windows/windows_file_system.cc b/tensorflow/core/platform/windows/windows_file_system.cc
index 31516bb2ee..670abf3fdf 100644
--- a/tensorflow/core/platform/windows/windows_file_system.cc
+++ b/tensorflow/core/platform/windows/windows_file_system.cc
@@ -467,6 +467,23 @@ Status WindowsFileSystem::RenameFile(const string& src, const string& target) {
return result;
}
+Status WindowsFileSystem::GetMatchingPaths(const string& pattern,
+ std::vector<string>* results) {
+ // NOTE(mrry): The existing implementation of FileSystem::GetMatchingPaths()
+ // does not handle Windows paths containing backslashes correctly. Since
+ // Windows APIs will accept forward and backslashes equivalently, we
+ // convert the pattern to use forward slashes exclusively. Note that this
+ // is not ideal, since the API expects backslash as an escape character,
+ // but no code appears to rely on this behavior.
+ string converted_pattern(pattern);
+ std::replace(converted_pattern.begin(), converted_pattern.end(), '\\', '/');
+ TF_RETURN_IF_ERROR(FileSystem::GetMatchingPaths(converted_pattern, results));
+ for (string& result : *results) {
+ std::replace(result.begin(), result.end(), '/', '\\');
+ }
+ return Status::OK();
+}
+
Status WindowsFileSystem::Stat(const string& fname, FileStatistics* stat) {
Status result;
struct _stat sbuf;