From 6109ca22e9220cde7f016d2b06bacd05dccf0c7a Mon Sep 17 00:00:00 2001 From: Gregory Jefferis Date: Thu, 16 Apr 2015 15:56:45 +0100 Subject: [PATCH 1/2] new movefile function * bypasses python by using Java for file move --- cmtkgui.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmtkgui.py b/cmtkgui.py index 0789fd7..57d66be 100644 --- a/cmtkgui.py +++ b/cmtkgui.py @@ -368,3 +368,15 @@ def download_and_untar_url(download_url,target_dir,untarfun,download_file=None, untarfun(tf.name,target_dir) IJ.showStatus('Cleaning up!') tf.close() + +def movefile(frompath, todir): + ''' + move a file to a new location (renaming) using Java calls + needed because jython shutil.move has bugs + ''' + if is_jython: + fromf=java.io.File(frompath) + tof=java.io.File(os.path.join(todir,os.path.basename(frompath))) + fromf.renameTo(tof) + else: + shutil.move(frompath, to) From 97986f20f54356002b5fc05612d8a3bafc5c52a4 Mon Sep 17 00:00:00 2001 From: Gregory Jefferis Date: Thu, 16 Apr 2015 15:58:07 +0100 Subject: [PATCH 2/2] shutil.move->cmtkgui.movefile in CMTK installer * this closes https://github.com/jefferis/fiji-cmtk-gui/issues/4 --- Install_CMTK.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install_CMTK.py b/Install_CMTK.py index 46e0af7..67fcce5 100644 --- a/Install_CMTK.py +++ b/Install_CMTK.py @@ -47,7 +47,7 @@ def untar_binaries(f,target_dir): for binary in binaries: frompath = os.path.join(td,binary.name) # print 'from = '+frompath - shutil.move(frompath,target_dir) + cmtkgui.movefile(frompath,target_dir) print("Cleaning up!") shutil.rmtree(td)