@Override
    public ApplicationFile delete() {
        if (file.isDirectory()) {
            // TODO: Use file.listFiles() when if we stop writing meta file when deleting directories.
            if (!listFiles().isEmpty())
                throw new RuntimeException("Can't delete, directory not empty: " + this + "(" + listFiles() + ")." + listFiles().size());

            var files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    deleteFile(f);
                }
            }
        }
        if (!file.delete())
            throw new IllegalStateException("Unable to delete: " + this);
        // TODO: No need to write this if the file is deleted?
        uncheck(() -> writeMetaFile("", ContentStatusDeleted));
        return this;
    }
@author Ulf Lilleengen
@author Vegard Havdal
config-application-package/src/main/java/com/yahoo/config/model/application/provider/FilesApplicationFile.java