mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 08:32:38 -06:00
91 lines
5.3 KiB
Java
91 lines
5.3 KiB
Java
package kotlin.io;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import io.flutter.plugin.editing.SpellCheckPlugin;
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import kotlin.Metadata;
|
|
import kotlin.collections.CollectionsKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.StringsKt;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* compiled from: FilePathComponents.kt */
|
|
@Metadata(d1 = {"\u0000$\n\u0000\n\u0002\u0010\u000b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\u001a\u0011\u0010\u000b\u001a\u00020\f*\u00020\bH\u0002¢\u0006\u0002\b\r\u001a\u001c\u0010\u000e\u001a\u00020\u0002*\u00020\u00022\u0006\u0010\u000f\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\fH\u0000\u001a\f\u0010\u0011\u001a\u00020\u0012*\u00020\u0002H\u0000\"\u0015\u0010\u0000\u001a\u00020\u0001*\u00020\u00028F¢\u0006\u0006\u001a\u0004\b\u0000\u0010\u0003\"\u0018\u0010\u0004\u001a\u00020\u0002*\u00020\u00028@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006\"\u0018\u0010\u0007\u001a\u00020\b*\u00020\u00028@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\t\u0010\n¨\u0006\u0013"}, d2 = {"isRooted", "", "Ljava/io/File;", "(Ljava/io/File;)Z", "root", "getRoot", "(Ljava/io/File;)Ljava/io/File;", "rootName", "", "getRootName", "(Ljava/io/File;)Ljava/lang/String;", "getRootLength", "", "getRootLength$FilesKt__FilePathComponentsKt", "subPath", "beginIndex", SpellCheckPlugin.END_INDEX_KEY, "toComponents", "Lkotlin/io/FilePathComponents;", "kotlin-stdlib"}, k = 5, mv = {1, 9, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_EDITOR_ABSOLUTEX, xs = "kotlin/io/FilesKt")
|
|
/* loaded from: classes3.dex */
|
|
public class FilesKt__FilePathComponentsKt {
|
|
private static final int getRootLength$FilesKt__FilePathComponentsKt(String str) {
|
|
int indexOf$default;
|
|
String str2 = str;
|
|
int indexOf$default2 = StringsKt.indexOf$default((CharSequence) str2, File.separatorChar, 0, false, 4, (Object) null);
|
|
if (indexOf$default2 == 0) {
|
|
if (str.length() <= 1 || str.charAt(1) != File.separatorChar || (indexOf$default = StringsKt.indexOf$default((CharSequence) str2, File.separatorChar, 2, false, 4, (Object) null)) < 0) {
|
|
return 1;
|
|
}
|
|
int indexOf$default3 = StringsKt.indexOf$default((CharSequence) str2, File.separatorChar, indexOf$default + 1, false, 4, (Object) null);
|
|
return indexOf$default3 >= 0 ? indexOf$default3 + 1 : str.length();
|
|
}
|
|
if (indexOf$default2 > 0 && str.charAt(indexOf$default2 - 1) == ':') {
|
|
return indexOf$default2 + 1;
|
|
}
|
|
if (indexOf$default2 == -1 && StringsKt.endsWith$default((CharSequence) str2, ':', false, 2, (Object) null)) {
|
|
return str.length();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public static final String getRootName(File file) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
String path = file.getPath();
|
|
Intrinsics.checkNotNullExpressionValue(path, "getPath(...)");
|
|
String path2 = file.getPath();
|
|
Intrinsics.checkNotNullExpressionValue(path2, "getPath(...)");
|
|
String substring = path.substring(0, getRootLength$FilesKt__FilePathComponentsKt(path2));
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
return substring;
|
|
}
|
|
|
|
public static final File getRoot(File file) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
return new File(FilesKt.getRootName(file));
|
|
}
|
|
|
|
public static final boolean isRooted(File file) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
String path = file.getPath();
|
|
Intrinsics.checkNotNullExpressionValue(path, "getPath(...)");
|
|
return getRootLength$FilesKt__FilePathComponentsKt(path) > 0;
|
|
}
|
|
|
|
public static final FilePathComponents toComponents(File file) {
|
|
ArrayList arrayList;
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
String path = file.getPath();
|
|
Intrinsics.checkNotNull(path);
|
|
int rootLength$FilesKt__FilePathComponentsKt = getRootLength$FilesKt__FilePathComponentsKt(path);
|
|
String substring = path.substring(0, rootLength$FilesKt__FilePathComponentsKt);
|
|
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
|
|
String substring2 = path.substring(rootLength$FilesKt__FilePathComponentsKt);
|
|
Intrinsics.checkNotNullExpressionValue(substring2, "substring(...)");
|
|
String str = substring2;
|
|
if (str.length() == 0) {
|
|
arrayList = CollectionsKt.emptyList();
|
|
} else {
|
|
List split$default = StringsKt.split$default((CharSequence) str, new char[]{File.separatorChar}, false, 0, 6, (Object) null);
|
|
ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(split$default, 10));
|
|
Iterator it = split$default.iterator();
|
|
while (it.hasNext()) {
|
|
arrayList2.add(new File((String) it.next()));
|
|
}
|
|
arrayList = arrayList2;
|
|
}
|
|
return new FilePathComponents(new File(substring), arrayList);
|
|
}
|
|
|
|
public static final File subPath(File file, int i, int i2) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
return FilesKt.toComponents(file).subPath(i, i2);
|
|
}
|
|
}
|