Rabbit-R1/switch port/smali/smali_classes3/kotlin/io/path/PathRelativizer.smali
2024-05-21 17:08:36 -04:00

257 lines
6.6 KiB
Smali

.class final Lkotlin/io/path/PathRelativizer;
.super Ljava/lang/Object;
.source "PathUtils.kt"
# annotations
.annotation runtime Lkotlin/Metadata;
d1 = {
"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0006\u0008\u00c2\u0002\u0018\u00002\u00020\u0001B\u0007\u0008\u0002\u00a2\u0006\u0002\u0010\u0002J\u0016\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0008\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\u0004R\u0016\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\n"
}
d2 = {
"Lkotlin/io/path/PathRelativizer;",
"",
"()V",
"emptyPath",
"Ljava/nio/file/Path;",
"kotlin.jvm.PlatformType",
"parentPath",
"tryRelativeTo",
"path",
"base",
"kotlin-stdlib-jdk7"
}
k = 0x1
mv = {
0x1,
0x9,
0x0
}
xi = 0x30
.end annotation
# static fields
.field public static final INSTANCE:Lkotlin/io/path/PathRelativizer;
.field private static final emptyPath:Ljava/nio/file/Path;
.field private static final parentPath:Ljava/nio/file/Path;
# direct methods
.method static constructor <clinit>()V
.locals 3
new-instance v0, Lkotlin/io/path/PathRelativizer;
invoke-direct {v0}, Lkotlin/io/path/PathRelativizer;-><init>()V
sput-object v0, Lkotlin/io/path/PathRelativizer;->INSTANCE:Lkotlin/io/path/PathRelativizer;
const/4 v0, 0x0
new-array v1, v0, [Ljava/lang/String;
const-string v2, ""
.line 160
invoke-static {v2, v1}, Ljava/nio/file/Paths;->get(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
move-result-object v1
sput-object v1, Lkotlin/io/path/PathRelativizer;->emptyPath:Ljava/nio/file/Path;
const-string v1, ".."
new-array v0, v0, [Ljava/lang/String;
.line 161
invoke-static {v1, v0}, Ljava/nio/file/Paths;->get(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
move-result-object v0
sput-object v0, Lkotlin/io/path/PathRelativizer;->parentPath:Ljava/nio/file/Path;
return-void
.end method
.method private constructor <init>()V
.locals 0
.line 159
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
# virtual methods
.method public final tryRelativeTo(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/nio/file/Path;
.locals 5
const-string p0, "path"
invoke-static {p1, p0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string p0, "base"
invoke-static {p2, p0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 165
invoke-interface {p2}, Ljava/nio/file/Path;->normalize()Ljava/nio/file/Path;
move-result-object p0
.line 166
invoke-interface {p1}, Ljava/nio/file/Path;->normalize()Ljava/nio/file/Path;
move-result-object p1
.line 167
invoke-interface {p0, p1}, Ljava/nio/file/Path;->relativize(Ljava/nio/file/Path;)Ljava/nio/file/Path;
move-result-object p2
.line 169
invoke-interface {p0}, Ljava/nio/file/Path;->getNameCount()I
move-result v0
invoke-interface {p1}, Ljava/nio/file/Path;->getNameCount()I
move-result v1
invoke-static {v0, v1}, Ljava/lang/Math;->min(II)I
move-result v0
const/4 v1, 0x0
move v2, v1
:goto_0
if-ge v2, v0, :cond_1
.line 170
invoke-interface {p0, v2}, Ljava/nio/file/Path;->getName(I)Ljava/nio/file/Path;
move-result-object v3
sget-object v4, Lkotlin/io/path/PathRelativizer;->parentPath:Ljava/nio/file/Path;
invoke-static {v3, v4}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 171
invoke-interface {p1, v2}, Ljava/nio/file/Path;->getName(I)Ljava/nio/file/Path;
move-result-object v3
invoke-static {v3, v4}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "Unable to compute relative path"
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.line 174
:cond_1
invoke-static {p1, p0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_2
sget-object v0, Lkotlin/io/path/PathRelativizer;->emptyPath:Ljava/nio/file/Path;
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result p0
if-eqz p0, :cond_2
goto :goto_1
.line 177
:cond_2
invoke-virtual {p2}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
.line 179
invoke-interface {p2}, Ljava/nio/file/Path;->getFileSystem()Ljava/nio/file/FileSystem;
move-result-object p1
invoke-virtual {p1}, Ljava/nio/file/FileSystem;->getSeparator()Ljava/lang/String;
move-result-object p1
const-string v0, "getSeparator(...)"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
const/4 v0, 0x2
const/4 v2, 0x0
invoke-static {p0, p1, v1, v0, v2}, Lkotlin/text/StringsKt;->endsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_3
.line 180
invoke-interface {p2}, Ljava/nio/file/Path;->getFileSystem()Ljava/nio/file/FileSystem;
move-result-object p1
invoke-interface {p2}, Ljava/nio/file/Path;->getFileSystem()Ljava/nio/file/FileSystem;
move-result-object p2
invoke-virtual {p2}, Ljava/nio/file/FileSystem;->getSeparator()Ljava/lang/String;
move-result-object p2
invoke-virtual {p2}, Ljava/lang/String;->length()I
move-result p2
invoke-static {p0, p2}, Lkotlin/text/StringsKt;->dropLast(Ljava/lang/String;I)Ljava/lang/String;
move-result-object p0
new-array p2, v1, [Ljava/lang/String;
invoke-virtual {p1, p0, p2}, Ljava/nio/file/FileSystem;->getPath(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
move-result-object p1
goto :goto_1
:cond_3
move-object p1, p2
.line 184
:goto_1
invoke-static {p1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
return-object p1
.end method