Skip to content

Commit

Permalink
Do not delete uuid when purging Polypheny home folder
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti committed Dec 7, 2023
1 parent 6297ac5 commit 4333774
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/main/java/org/polypheny/control/control/ServiceManager.java
Expand Up @@ -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!" );
}
}

Expand Down

0 comments on commit 4333774

Please sign in to comment.