package coil.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import p5.AbstractC2749t;
import p5.G;

/* JADX INFO: renamed from: coil.util.-FileSystems, reason: invalid class name */
/* JADX INFO: loaded from: classes.dex */
public final class FileSystems {
    public static final void createFile(AbstractC2749t abstractC2749t, G g6) {
        if (abstractC2749t.exists(g6)) {
            return;
        }
        Utils.closeQuietly(abstractC2749t.sink(g6));
    }

    public static final void deleteContents(AbstractC2749t abstractC2749t, G g6) {
        try {
            IOException iOException = null;
            for (G g7 : abstractC2749t.list(g6)) {
                try {
                    if (abstractC2749t.metadata(g7).f23116b) {
                        deleteContents(abstractC2749t, g7);
                    }
                    abstractC2749t.delete(g7);
                } catch (IOException e6) {
                    if (iOException == null) {
                        iOException = e6;
                    }
                }
            }
            if (iOException != null) {
                throw iOException;
            }
        } catch (FileNotFoundException unused) {
        }
    }
}
