aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/lib
diff options
context:
space:
mode:
authorGravatar Ankur Taly <ataly@google.com>2018-02-16 18:22:55 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-02-16 18:27:19 -0800
commit0e6f39d1bd7fe8daa86944f6ab0dd94fbeb4962a (patch)
treeee0dabaff4147ecc9bc92acd2a50dadbfd694f39 /tensorflow/python/lib
parent128572c316e6f2eb6346f920314ef98e88e75069 (diff)
Merge changes from github.
PiperOrigin-RevId: 186073337
Diffstat (limited to 'tensorflow/python/lib')
-rw-r--r--tensorflow/python/lib/io/file_io.i16
1 files changed, 5 insertions, 11 deletions
diff --git a/tensorflow/python/lib/io/file_io.i b/tensorflow/python/lib/io/file_io.i
index c0c4e035fc..891a7b0fd0 100644
--- a/tensorflow/python/lib/io/file_io.i
+++ b/tensorflow/python/lib/io/file_io.i
@@ -110,21 +110,15 @@ void RecursivelyCreateDir(const string& dirname, TF_Status* out_status) {
}
}
-void CopyFile(const string& oldpath, const string& newpath, bool overwrite,
+void CopyFile(const string& src, const string& target, bool overwrite,
TF_Status* out_status) {
- // If overwrite is false and the newpath file exists then it's an error.
- if (!overwrite && tensorflow::Env::Default()->FileExists(newpath).ok()) {
+ // If overwrite is false and the target file exists then its an error.
+ if (!overwrite && tensorflow::Env::Default()->FileExists(target).ok()) {
TF_SetStatus(out_status, TF_ALREADY_EXISTS, "file already exists");
return;
}
- string file_content;
- tensorflow::Status status = ReadFileToString(tensorflow::Env::Default(),
- oldpath, &file_content);
- if (!status.ok()) {
- Set_TF_Status_from_Status(out_status, status);
- return;
- }
- status = WriteStringToFile(tensorflow::Env::Default(), newpath, file_content);
+ tensorflow::Status status =
+ tensorflow::Env::Default()->CopyFile(src, target);
if (!status.ok()) {
Set_TF_Status_from_Status(out_status, status);
}