package com.tencent.mm.plugin.appbrand.jsapi.file;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.appstorage.h;
import com.tencent.mm.plugin.appbrand.jsapi.c;
import com.tencent.mm.plugin.appbrand.r.j;
import java.util.LinkedList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;

final class ar extends d {
    ar() {
    }

    /* Access modifiers changed, original: final */
    public final f$a a(c cVar, String str, JSONObject jSONObject) {
        AppMethodBeat.i(102825);
        LinkedList<h> linkedList = new LinkedList();
        j jVar = new j();
        com.tencent.mm.plugin.appbrand.appstorage.j a = cVar.asE().a(str, jVar);
        com.tencent.luggage.g.c.c(linkedList, (List) jVar.value);
        f$a f_a;
        switch (1.hJS[a.ordinal()]) {
            case 1:
            case 2:
                f_a = new f$a("fail no such file or directory \"%s\"", str);
                AppMethodBeat.o(102825);
                return f_a;
            case 3:
                f_a = new f$a("fail not a directory \"%s\"", str);
                AppMethodBeat.o(102825);
                return f_a;
            case 4:
                f_a = new f$a("fail permission denied, open \"%s\"", str);
                AppMethodBeat.o(102825);
                return f_a;
            case 5:
                f_a = new f$a("fail \"%s\" is not a regular file", str);
                AppMethodBeat.o(102825);
                return f_a;
            case 6:
                JSONArray jSONArray = new JSONArray();
                for (h hVar : linkedList) {
                    jSONArray.put(hVar.fileName);
                }
                f_a = new f$a("ok", new Object[0]).o("files", jSONArray);
                AppMethodBeat.o(102825);
                return f_a;
            default:
                f_a = new f$a("fail " + a.name(), new Object[0]);
                AppMethodBeat.o(102825);
                return f_a;
        }
    }
}
