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) 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)