Skip to content

Commit

Permalink
??
Browse files Browse the repository at this point in the history
  • Loading branch information
shashachu committed Jun 14, 2021
1 parent f873257 commit 413a152
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import com.pinterest.ktlint.core.LintError
import com.pinterest.ktlint.core.RuleSet
import com.pinterest.ktlint.core.api.FeatureInAlphaState
import java.io.File
import java.nio.file.FileSystem
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.nio.file.SimpleFileVisitor
import java.nio.file.*
import java.nio.file.attribute.BasicFileAttributes
import kotlin.system.exitProcess

Expand All @@ -25,7 +20,13 @@ internal fun FileSystem.fileSequence(

val result = mutableListOf<Path>()

val (existingFiles, actualGlobs) = globs.partition { Files.isRegularFile(rootDir.resolve(it)) }
val (existingFiles, actualGlobs) = globs.partition {
try {
Files.isRegularFile(rootDir.resolve(it))
} catch (e: InvalidPathException) {
false
}
}
existingFiles.mapTo(result) { rootDir.resolve(it) }

// Return early and don't traverse the file system if all the input globs are absolute paths
Expand Down

0 comments on commit 413a152

Please sign in to comment.