kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

`SystemPathSeparator` defined as `/` for Window

Open 05nelsonm opened this issue 1 year ago • 3 comments
trafficstars

SystemPathSeparator is defined in nativeMain

05nelsonm avatar Dec 07 '23 23:12 05nelsonm

That was done intentionally as Windows should correctly handle both \ and / as path separators (/ are canonicalized to \) and using / as the separator seemed an easier option. Are there any cases where it works incorrectly? Or it's mostly about SystemPathSeparator itself being non-canonical for Windows?

fzhinkin avatar Dec 08 '23 10:12 fzhinkin

Completely understandable if it was internal, but it is a part of the public API. Anyone from commonMain relying on SystemPathSeparator would "assume" that it delegates to the actual system path separator (like Jvm and Js are doing).

If nativeMain is in conflict with the actual system's path separator, why not drop the expect/actual and define SystemPathSeparator in commonMain as /?

05nelsonm avatar Dec 08 '23 10:12 05nelsonm

I'll address the issue in scope of https://github.com/Kotlin/kotlinx-io/issues/241.

fzhinkin avatar Dec 08 '23 14:12 fzhinkin