private static File initializeDirectory() {
        File directory;
        String path = System.getProperty(PropKey, System.getProperty(PropFileName, ""));
        if (path.length() == 0) {
            directory = new File(DefaultDir);
        } else {
            File file = new File(path);
            if (file.isDirectory()) {
                directory = file;
            } else {
                directory = file.getParentFile();
                if (directory == null) {
                    directory = new File(DefaultDir);
                }
            }
        }
        try {
            if (!directory.isDirectory()) {
                if (!directory.mkdirs() || !directory.isDirectory()) {
                    throw new IOException("can't make directory: " + directory);
                }
            }
        } catch (IOException ex) {
            throw new IllegalStateException(ex);
        }
        return directory;
    }