diff --git a/src/main/java/org/polypheny/control/control/ServiceManager.java b/src/main/java/org/polypheny/control/control/ServiceManager.java index 98ecc88..db41b37 100644 --- a/src/main/java/org/polypheny/control/control/ServiceManager.java +++ b/src/main/java/org/polypheny/control/control/ServiceManager.java @@ -843,14 +843,23 @@ public static boolean purgePolyphenyFolder( ClientCommunicationStream clientComm if ( clientCommunicationStream != null ) { clientCommunicationStream.send( "> Purging Polypheny home folder (" + polyphenyDir.getAbsolutePath() + ")..." ); } - if ( polyphenyDir.exists() ) { - try { - FileUtils.deleteDirectory( polyphenyDir ); - } catch ( IOException e ) { - if ( clientCommunicationStream != null ) { - clientCommunicationStream.send( "> Unable to purge Polypheny home folder!" ); + if ( polyphenyDir.exists() && polyphenyDir.isDirectory() ) { + for ( File f : polyphenyDir.listFiles() ) { + if ( f.getName().equals( "uuid" ) ) { + continue; + } + try { + if ( f.isDirectory() ) { + FileUtils.deleteDirectory( f ); + } else { + f.delete(); + } + } catch ( IOException e ) { + if ( clientCommunicationStream != null ) { + clientCommunicationStream.send( "> Unable to purge Polypheny home folder!" ); + } + throw new RuntimeException( "Unable to purge Polypheny home folder!" ); } - throw new RuntimeException( "Unable to purge Polypheny home folder!" ); } }