java - Once I've finished using a working copy with SVNKit, how can I remove it? -


i have created class perform commits subversion repository using svnkit. when i've completed commits want destroy temporary directory using working copy.

the way i'm creating working copy directory follows:

    path svnworkingcopydirectory = files             .createtempdirectory("svn-working-copy-directory-"                     + string.valueof(system.currenttimemillis()));     logger.debug("created svn working copy directory: " + svnworkingcopydirectory);     svnworkingcopydirectory.tofile().deleteonexit(); 

however, directory not deleted on exit. there way in svnkit mark directory no longer working copy? or method remove directory?

file.deleteonexit() works file.delete() , files.delete() in respect fact if argument denotes directory, directory must empty removed in case not.

so if want delete directory on exit must register shutdown hook , in method have iterate recursively through directory depth first remove files , empty directories.

apache commons has delete method might use in shutdown hook or whenever appropriate you: https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/fileutils.html#deletedirectory(java.io.file)


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -