- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
107 lines
3.9 KiB
Java
107 lines
3.9 KiB
Java
package kotlin.io;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileOutputStream;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.text.StringsKt__StringsKt;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class FilesKt__UtilsKt extends FilesKt__FileTreeWalkKt {
|
|
public static String getExtension(File file) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
String name = file.getName();
|
|
Intrinsics.checkNotNullExpressionValue(name, "getName(...)");
|
|
return StringsKt__StringsKt.substringAfterLast(name, '.', "");
|
|
}
|
|
|
|
public static /* synthetic */ File copyTo$default(File file, File file2, boolean z, int i, int i2, Object obj) {
|
|
if ((i2 & 2) != 0) {
|
|
z = false;
|
|
}
|
|
if ((i2 & 4) != 0) {
|
|
i = 8192;
|
|
}
|
|
return copyTo(file, file2, z, i);
|
|
}
|
|
|
|
public static final File copyTo(File file, File target, boolean z, int i) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
Intrinsics.checkNotNullParameter(target, "target");
|
|
if (!file.exists()) {
|
|
throw new NoSuchFileException(file, null, "The source file doesn't exist.", 2, null);
|
|
}
|
|
if (target.exists()) {
|
|
if (!z) {
|
|
throw new FileAlreadyExistsException(file, target, "The destination file already exists.");
|
|
}
|
|
if (!target.delete()) {
|
|
throw new FileAlreadyExistsException(file, target, "Tried to overwrite the destination, but failed to delete it.");
|
|
}
|
|
}
|
|
if (file.isDirectory()) {
|
|
if (!target.mkdirs()) {
|
|
throw new FileSystemException(file, target, "Failed to create target directory.");
|
|
}
|
|
} else {
|
|
File parentFile = target.getParentFile();
|
|
if (parentFile != null) {
|
|
parentFile.mkdirs();
|
|
}
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
try {
|
|
FileOutputStream fileOutputStream = new FileOutputStream(target);
|
|
try {
|
|
ByteStreamsKt.copyTo(fileInputStream, fileOutputStream, i);
|
|
CloseableKt.closeFinally(fileOutputStream, null);
|
|
CloseableKt.closeFinally(fileInputStream, null);
|
|
} finally {
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
|
|
public static boolean deleteRecursively(File file) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
while (true) {
|
|
boolean z = true;
|
|
for (File file2 : FilesKt__FileTreeWalkKt.walkBottomUp(file)) {
|
|
if (file2.delete() || !file2.exists()) {
|
|
if (z) {
|
|
break;
|
|
}
|
|
}
|
|
z = false;
|
|
}
|
|
return z;
|
|
}
|
|
}
|
|
|
|
public static final File resolve(File file, File relative) {
|
|
boolean endsWith$default;
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
Intrinsics.checkNotNullParameter(relative, "relative");
|
|
if (FilesKt__FilePathComponentsKt.isRooted(relative)) {
|
|
return relative;
|
|
}
|
|
String file2 = file.toString();
|
|
Intrinsics.checkNotNullExpressionValue(file2, "toString(...)");
|
|
if (file2.length() != 0) {
|
|
char c = File.separatorChar;
|
|
endsWith$default = StringsKt__StringsKt.endsWith$default((CharSequence) file2, c, false, 2, (Object) null);
|
|
if (!endsWith$default) {
|
|
return new File(file2 + c + relative);
|
|
}
|
|
}
|
|
return new File(file2 + relative);
|
|
}
|
|
|
|
public static File resolve(File file, String relative) {
|
|
Intrinsics.checkNotNullParameter(file, "<this>");
|
|
Intrinsics.checkNotNullParameter(relative, "relative");
|
|
return resolve(file, new File(relative));
|
|
}
|
|
}
|