Replace File.relativePath from stdlib with File.descendantRelativeTo in fileUtils.
IO utils: cleanup java usages.
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.cli.common.messages;
|
||||
import kotlin.io.FilesKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.utils.fileUtils.FileUtilsKt;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -43,13 +44,14 @@ public interface MessageRenderer {
|
||||
};
|
||||
|
||||
MessageRenderer PLAIN_RELATIVE_PATHS = new PlainTextMessageRenderer() {
|
||||
@NotNull
|
||||
private final File cwd = new File(".").getAbsoluteFile();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
String path = location.getPath();
|
||||
return cwd == null || path == null ? path : FilesKt.relativePath(cwd, new File(path));
|
||||
return path == null ? path : FileUtilsKt.descendantRelativeTo(new File(path), cwd).getPath();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.psi.PsiManager;
|
||||
import kotlin.Unit;
|
||||
import kotlin.io.FilesKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.sequences.SequencesKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
@@ -162,7 +163,7 @@ public class CompileEnvironmentUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
FilesKt.recurse(new File(sourceRootPath), new Function1<File, Unit>() {
|
||||
SequencesKt.forEach(FilesKt.walkTopDown(new File(sourceRootPath)), new Function1<File, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(File file) {
|
||||
if (file.isFile()) {
|
||||
|
||||
Reference in New Issue
Block a user