package org.hyperledger.indy.sdk.utils;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;


public class StorageUtils {

	private static void cleanDirectory(File path) throws IOException {
		if (path.isDirectory()) {
			FileUtils.cleanDirectory(path);
		}
	}

	public static void cleanupStorage() throws IOException {
		System.out.println("cleanupStorage >>");

		File tmpDir = new File(getTmpPath());
		File homeDir = new File(getIndyHomePath());

		StorageUtils.cleanDirectory(tmpDir);
		StorageUtils.cleanDirectory(homeDir);
		System.out.println("cleanupStorage <<");
	}

	public static String getIndyHomePath() {
		return FileUtils.getUserDirectoryPath() + "/.indy/";
	}

	public static String getIndyHomePath(String filename) {
		return getIndyHomePath() + filename;
	}

	public static String getTmpPath() {
		return FileUtils.getTempDirectoryPath() + "/indy/";
	}

	public static String getTmpPath(String filename) {
		return getTmpPath() + filename;
	}
}

@@ -394,16 +394,38 @@
 ge %3E%3E%22);
+%0A%09%09Thread.dumpStack();
 %0A%0A%09%09File

Add dumpStack for cleanupStorage in java tests.