private void configurePermissions(final File file) {
        final Path path = file.toPath();
        if (path.getFileSystem().supportedFileAttributeViews().contains("posix")) {
            final Set<PosixFilePermission> perms = PosixFilePermissions.fromString("rwxr-x---");
            try {
                Files.setPosixFilePermissions(path, perms);
            } catch (final IOException e) {
                log.error("Error changing permissions for the directory {} ", path, e);
            }
        } else {
            boolean set = file.setReadable(true, true);
            set &= file.setWritable(true, true);
            set &= file.setExecutable(true, true);
            if (!set) {
                log.error("Failed to change permissions for the directory {}", file);
            }
        }
    }
Ensures that the state base directory as well as the application's sub-directory are created.

@param config              streams application configuration to read the root state directory path
@param time                system timer used to execute periodic cleanup procedure
@param hasPersistentStores only when the application's topology does have stores persisted on local file
                           system, we would go ahead and auto-create the corresponding application / task / store
                           directories whenever necessary; otherwise no directories would be created.
@param hasNamedTopologies  whether this application is composed of independent named topologies

@throws ProcessorStateException if the base state directory or application state directory does not exist
                                and could not be created when hasPersistentStores is enabled.
streams/src/main/java/org/apache/kafka/streams/processor/internals/StateDirectory.java