2021-06-27 20:44:35 +00:00
|
|
|
package d0.y;
|
|
|
|
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayDeque;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.io.AccessDeniedException;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.functions.Function2;
|
|
|
|
import kotlin.sequences.Sequence;
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public final class d implements Sequence<File> {
|
|
|
|
public final File a;
|
|
|
|
public final e b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-04 15:26:29 +00:00
|
|
|
public final Function1<File, Boolean> f2693c = null;
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Function1<File, Unit> d = null;
|
|
|
|
public final Function2<File, IOException, Unit> e = null;
|
|
|
|
public final int f = Integer.MAX_VALUE;
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public static abstract class a extends c {
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(File file) {
|
|
|
|
super(file);
|
|
|
|
m.checkNotNullParameter(file, "rootDir");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public final class b extends d0.t.b<File> {
|
|
|
|
public final ArrayDeque<c> k;
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public final class a extends a {
|
|
|
|
public boolean b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-04 15:26:29 +00:00
|
|
|
public File[] f2694c;
|
2021-06-27 20:44:35 +00:00
|
|
|
public int d;
|
|
|
|
public boolean e;
|
|
|
|
public final /* synthetic */ b f;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(b bVar, File file) {
|
|
|
|
super(file);
|
|
|
|
m.checkNotNullParameter(file, "rootDir");
|
|
|
|
this.f = bVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // d0.y.d.c
|
|
|
|
public File step() {
|
2021-07-04 15:26:29 +00:00
|
|
|
if (!this.e && this.f2694c == null) {
|
2021-06-27 20:44:35 +00:00
|
|
|
Function1 access$getOnEnter$p = d.access$getOnEnter$p(d.this);
|
|
|
|
if (access$getOnEnter$p != null && !((Boolean) access$getOnEnter$p.invoke(getRoot())).booleanValue()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
File[] listFiles = getRoot().listFiles();
|
2021-07-04 15:26:29 +00:00
|
|
|
this.f2694c = listFiles;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (listFiles == null) {
|
|
|
|
Function2 access$getOnFail$p = d.access$getOnFail$p(d.this);
|
|
|
|
if (access$getOnFail$p != null) {
|
|
|
|
Unit unit = (Unit) access$getOnFail$p.invoke(getRoot(), new AccessDeniedException(getRoot(), null, "Cannot list files in a directory", 2, null));
|
|
|
|
}
|
|
|
|
this.e = true;
|
|
|
|
}
|
|
|
|
}
|
2021-07-04 15:26:29 +00:00
|
|
|
File[] fileArr = this.f2694c;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (fileArr != null) {
|
|
|
|
int i = this.d;
|
|
|
|
m.checkNotNull(fileArr);
|
|
|
|
if (i < fileArr.length) {
|
2021-07-04 15:26:29 +00:00
|
|
|
File[] fileArr2 = this.f2694c;
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNull(fileArr2);
|
|
|
|
int i2 = this.d;
|
|
|
|
this.d = i2 + 1;
|
|
|
|
return fileArr2[i2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!this.b) {
|
|
|
|
this.b = true;
|
|
|
|
return getRoot();
|
|
|
|
}
|
|
|
|
Function1 access$getOnLeave$p = d.access$getOnLeave$p(d.this);
|
|
|
|
if (access$getOnLeave$p != null) {
|
|
|
|
Unit unit2 = (Unit) access$getOnLeave$p.invoke(getRoot());
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
/* renamed from: d0.y.d$b$b reason: collision with other inner class name */
|
|
|
|
public final class C0301b extends c {
|
|
|
|
public boolean b;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public C0301b(b bVar, File file) {
|
|
|
|
super(file);
|
|
|
|
m.checkNotNullParameter(file, "rootFile");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // d0.y.d.c
|
|
|
|
public File step() {
|
|
|
|
if (this.b) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
this.b = true;
|
|
|
|
return getRoot();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public final class c extends a {
|
|
|
|
public boolean b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-04 15:26:29 +00:00
|
|
|
public File[] f2695c;
|
2021-06-27 20:44:35 +00:00
|
|
|
public int d;
|
|
|
|
public final /* synthetic */ b e;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public c(b bVar, File file) {
|
|
|
|
super(file);
|
|
|
|
m.checkNotNullParameter(file, "rootDir");
|
|
|
|
this.e = bVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:27:0x0085, code lost:
|
|
|
|
if (r0.length == 0) goto L_0x0087;
|
|
|
|
*/
|
|
|
|
@Override // d0.y.d.c
|
|
|
|
public File step() {
|
|
|
|
Function2 access$getOnFail$p;
|
|
|
|
if (!this.b) {
|
|
|
|
Function1 access$getOnEnter$p = d.access$getOnEnter$p(d.this);
|
|
|
|
if (access$getOnEnter$p != null && !((Boolean) access$getOnEnter$p.invoke(getRoot())).booleanValue()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
this.b = true;
|
|
|
|
return getRoot();
|
|
|
|
}
|
2021-07-04 15:26:29 +00:00
|
|
|
File[] fileArr = this.f2695c;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (fileArr != null) {
|
|
|
|
int i = this.d;
|
|
|
|
m.checkNotNull(fileArr);
|
|
|
|
if (i >= fileArr.length) {
|
|
|
|
Function1 access$getOnLeave$p = d.access$getOnLeave$p(d.this);
|
|
|
|
if (access$getOnLeave$p != null) {
|
|
|
|
Unit unit = (Unit) access$getOnLeave$p.invoke(getRoot());
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2021-07-04 15:26:29 +00:00
|
|
|
if (this.f2695c == null) {
|
2021-06-27 20:44:35 +00:00
|
|
|
File[] listFiles = getRoot().listFiles();
|
2021-07-04 15:26:29 +00:00
|
|
|
this.f2695c = listFiles;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (listFiles == null && (access$getOnFail$p = d.access$getOnFail$p(d.this)) != null) {
|
|
|
|
Unit unit2 = (Unit) access$getOnFail$p.invoke(getRoot(), new AccessDeniedException(getRoot(), null, "Cannot list files in a directory", 2, null));
|
|
|
|
}
|
2021-07-04 15:26:29 +00:00
|
|
|
File[] fileArr2 = this.f2695c;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (fileArr2 != null) {
|
|
|
|
m.checkNotNull(fileArr2);
|
|
|
|
}
|
|
|
|
Function1 access$getOnLeave$p2 = d.access$getOnLeave$p(d.this);
|
|
|
|
if (access$getOnLeave$p2 != null) {
|
|
|
|
Unit unit3 = (Unit) access$getOnLeave$p2.invoke(getRoot());
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2021-07-04 15:26:29 +00:00
|
|
|
File[] fileArr3 = this.f2695c;
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNull(fileArr3);
|
|
|
|
int i2 = this.d;
|
|
|
|
this.d = i2 + 1;
|
|
|
|
return fileArr3[i2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public b() {
|
|
|
|
ArrayDeque<c> arrayDeque = new ArrayDeque<>();
|
|
|
|
this.k = arrayDeque;
|
|
|
|
if (d.access$getStart$p(d.this).isDirectory()) {
|
|
|
|
arrayDeque.push(c(d.access$getStart$p(d.this)));
|
|
|
|
} else if (d.access$getStart$p(d.this).isFile()) {
|
|
|
|
arrayDeque.push(new C0301b(this, d.access$getStart$p(d.this)));
|
|
|
|
} else {
|
|
|
|
this.i = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Failed to insert an additional move for type inference into block B:20:0x0040 */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: d0.y.d$b */
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r1v1, resolved type: T */
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
@Override // d0.t.b
|
|
|
|
public void a() {
|
|
|
|
T t;
|
|
|
|
while (true) {
|
|
|
|
c peek = this.k.peek();
|
|
|
|
if (peek == null) {
|
|
|
|
t = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
t = peek.step();
|
|
|
|
if (t != 0) {
|
|
|
|
if (m.areEqual(t, peek.getRoot()) || !t.isDirectory() || this.k.size() >= d.access$getMaxDepth$p(d.this)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
this.k.push(c(t));
|
|
|
|
} else {
|
|
|
|
this.k.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (t != 0) {
|
|
|
|
this.j = t;
|
|
|
|
this.i = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.i = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final a c(File file) {
|
|
|
|
int ordinal = d.access$getDirection$p(d.this).ordinal();
|
|
|
|
if (ordinal == 0) {
|
|
|
|
return new c(this, file);
|
|
|
|
}
|
|
|
|
if (ordinal == 1) {
|
|
|
|
return new a(this, file);
|
|
|
|
}
|
|
|
|
throw new NoWhenBranchMatchedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: FileTreeWalk.kt */
|
|
|
|
public static abstract class c {
|
|
|
|
public final File a;
|
|
|
|
|
|
|
|
public c(File file) {
|
|
|
|
m.checkNotNullParameter(file, "root");
|
|
|
|
this.a = file;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final File getRoot() {
|
|
|
|
return this.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract File step();
|
|
|
|
}
|
|
|
|
|
|
|
|
public d(File file, e eVar) {
|
|
|
|
m.checkNotNullParameter(file, "start");
|
|
|
|
m.checkNotNullParameter(eVar, "direction");
|
|
|
|
this.a = file;
|
|
|
|
this.b = eVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ e access$getDirection$p(d dVar) {
|
|
|
|
return dVar.b;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ int access$getMaxDepth$p(d dVar) {
|
|
|
|
return dVar.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function1 access$getOnEnter$p(d dVar) {
|
2021-07-04 15:26:29 +00:00
|
|
|
return dVar.f2693c;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function2 access$getOnFail$p(d dVar) {
|
|
|
|
return dVar.e;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ Function1 access$getOnLeave$p(d dVar) {
|
|
|
|
return dVar.d;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ File access$getStart$p(d dVar) {
|
|
|
|
return dVar.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // kotlin.sequences.Sequence
|
|
|
|
public Iterator<File> iterator() {
|
|
|
|
return new b();
|
|
|
|
}
|
|
|
|
}
|