public static void prepareForFileCreationOrReplacement ( Path path , Object requester , String operation ) throws IOException { if ( Files . deleteIfExists ( path ) ) OLogManager . instance ( ) . warn ( requester , "'%s' deleted while %s" , path , operation ) ; final Path parent = path . getParent ( ) ; if ( parent != null ) Files . createDirectories ( parent ) ; }
Prepares the path for a file creation or replacement . If the file pointed by the path already exists it will be deleted a warning will be emitted to the log in this case . All absent directories along the path will be created .