Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3229)

Unified Diff: experimental/PdfViewer/copy_files.py

Issue 23157003: pdfviewer: workaround gyp issue with multiple files, not being translated into an array in linux (w… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/pdfviewer.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/copy_files.py
===================================================================
--- experimental/PdfViewer/copy_files.py (revision 10721)
+++ experimental/PdfViewer/copy_files.py (working copy)
@@ -2,8 +2,24 @@
import shutil
import sys
+def copyfile(src, dst):
+ fsrc = None
+ fdst = None
+ try:
+ fsrc = open(src, 'rb')
+ fdst = open(dst, 'wb')
+ shutil.copyfileobj(fsrc, fdst)
+ finally:
+ if fdst:
+ fdst.close()
+ if fsrc:
+ fsrc.close()
+
dstdir = sys.argv[1]
+if not os.path.exists(dstdir):
+ os.makedirs(dstdir)
+
for i in range(2, len(sys.argv)):
- shutil.copy(sys.argv[i], dstdir)
+ copyfile(sys.argv[i], os.path.join(dstdir, os.path.basename(sys.argv[i])))
« no previous file with comments | « no previous file | gyp/pdfviewer.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698