square / okio

A modern I/O library for Android, Java, and Kotlin Multiplatform.
https://square.github.io/okio/
Apache License 2.0
8.72k stars 1.17k forks source link

Issue with folders named like 'X: Something' #1460

Open Ribesg opened 3 months ago

Ribesg commented 3 months ago

Okio behaves weirdly with folders named like X: Something on at least MacOS Arm64 and Linux X64.

You can easily reproduce the issue in a Gradle project with native targets:

fun main() {
    FileSystem.SYSTEM.run {
        createDirectories("build/tmp/Working Folder".toPath())
        createDirectories("build/tmp/X: Broken Folder".toPath())
        list("build/tmp".toPath()).forEach(::println)
    }
}
tmp$ ./gradlew clean runDebugExecutableMacosArm64

> Task :runDebugExecutableMacosArm64
X: Broken Folder
build/tmp/Working Folder

BUILD SUCCESSFUL in 3s
10 actionable tasks: 6 executed, 4 up-to-date
swankjesse commented 3 months ago

Oooh thanks for reporting this. I made a design decision to make path processing platform-independent, which is what’s causing grief here.

We’re incorrectly interpreting this as a Windows drive letter followed by a path name, rather than a single path name where the 2nd character is a colon. Ugh.

I’ll see what we can do to fix!