Skip to content

Commit 7ba8c40

Browse files
committed
Cleanup
1 parent 27d4132 commit 7ba8c40

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

core/common/src/files/FileSystem.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,6 @@ public class FileMetadata(
181181
* Signals an I/O operation's failure due to a missing file or directory.
182182
*/
183183
public expect class FileNotFoundException(message: String?) : IOException
184+
185+
internal const val WindowsPathSeparator: Char = '\\'
186+
internal const val UnixPathSeparator: Char = '/'

core/js/src/files/PathsJs.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public actual val SystemPathSeparator: Char by lazy {
7272
sep[0]
7373
}
7474

75-
private const val WindowsPathSeparator: Char = '\\'
76-
private const val UnixPathSeparator: Char = '/'
7775
public actual fun Path(path: String): Path {
7876
return Path(path, null)
7977
}

core/js/test/files/SmokeFileTestWindowsJS.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlin.test.Test
1010
import kotlin.test.assertEquals
1111
import kotlin.test.assertNull
1212

13-
class SmokeFileTestWindowMinGW {
13+
class SmokeFileTestWindowJS {
1414
@Test
1515
fun uncParent() {
1616
if (!isWindows) return

core/mingw/src/files/FileSystemMingw.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import kotlinx.io.IOException
1212
import platform.posix.*
1313
import platform.windows.*
1414

15-
private const val WindowsPathSeparator: Char = '\\'
16-
1715
internal actual fun atomicMoveImpl(source: Path, destination: Path) {
1816
if (MoveFileExA(source.path, destination.path, MOVEFILE_REPLACE_EXISTING.convert()) == 0) {
1917
// TODO: get formatted error message
@@ -22,7 +20,7 @@ internal actual fun atomicMoveImpl(source: Path, destination: Path) {
2220
}
2321

2422
internal actual fun dirnameImpl(path: String): String {
25-
if (!path.contains(SystemPathSeparator) && !path.contains(WindowsPathSeparator)) {
23+
if (!path.contains(UnixPathSeparator) && !path.contains(WindowsPathSeparator)) {
2624
return ""
2725
}
2826
memScoped {
@@ -39,7 +37,7 @@ internal actual fun basenameImpl(path: String): String {
3937
internal actual fun isAbsoluteImpl(path: String): Boolean {
4038
if (path.startsWith(SystemPathSeparator)) return true
4139
if (path.length > 1 && path[1] == ':') {
42-
if (path.length == 1) return false
40+
if (path.length == 2) return false
4341
val next = path[2]
4442
return next == WindowsPathSeparator || next == SystemPathSeparator
4543
}

core/native/src/files/PathsNative.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public actual class Path internal constructor(
5454
}
5555
}
5656

57-
public actual val SystemPathSeparator: Char = '/'
57+
public actual val SystemPathSeparator: Char = UnixPathSeparator
5858

5959
internal expect fun dirnameImpl(path: String): String
6060

0 commit comments

Comments
 (0)