Skip to content

Commit 270bdd3

Browse files
committed
Remove lineSeparator from Filesystem, define as a public extension function of OperatingSystem
1 parent 026c4ca commit 270bdd3

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

runtime/runtime-core/api/runtime-core.api

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,6 @@ public abstract interface class aws/smithy/kotlin/runtime/util/Filesystem {
23292329
public static final field Companion Laws/smithy/kotlin/runtime/util/Filesystem$Companion;
23302330
public abstract fun fileExists (Ljava/lang/String;)Z
23312331
public abstract fun getFilePathSeparator ()Ljava/lang/String;
2332-
public abstract fun getLineSeparator ()Ljava/lang/String;
23332332
public abstract fun readFileOrNull (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
23342333
public abstract fun writeFile (Ljava/lang/String;[BLkotlin/coroutines/Continuation;)Ljava/lang/Object;
23352334
}
@@ -2397,6 +2396,10 @@ public final class aws/smithy/kotlin/runtime/util/OsFamily : java/lang/Enum {
23972396
public abstract interface class aws/smithy/kotlin/runtime/util/PlatformEnvironProvider : aws/smithy/kotlin/runtime/util/EnvironmentProvider, aws/smithy/kotlin/runtime/util/PropertyProvider {
23982397
}
23992398

2399+
public final class aws/smithy/kotlin/runtime/util/PlatformKt {
2400+
public static final fun getLineSeparator (Laws/smithy/kotlin/runtime/util/OperatingSystem;)Ljava/lang/String;
2401+
}
2402+
24002403
public abstract interface class aws/smithy/kotlin/runtime/util/PlatformProvider : aws/smithy/kotlin/runtime/util/Filesystem, aws/smithy/kotlin/runtime/util/PlatformEnvironProvider {
24012404
public static final field Companion Laws/smithy/kotlin/runtime/util/PlatformProvider$Companion;
24022405
public abstract fun isAndroid ()Z
@@ -2438,7 +2441,6 @@ public final class aws/smithy/kotlin/runtime/util/TestPlatformProvider : aws/smi
24382441
public fun getAllEnvVars ()Ljava/util/Map;
24392442
public fun getAllProperties ()Ljava/util/Map;
24402443
public fun getFilePathSeparator ()Ljava/lang/String;
2441-
public fun getLineSeparator ()Ljava/lang/String;
24422444
public fun getProperty (Ljava/lang/String;)Ljava/lang/String;
24432445
public fun getenv (Ljava/lang/String;)Ljava/lang/String;
24442446
public fun isAndroid ()Z

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/Filesystem.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ public interface Filesystem {
1616
*/
1717
public val filePathSeparator: String
1818

19-
/**
20-
* The string which represents a line separator on this file system. For example, on Windows, this is CRLF.
21-
*/
22-
public val lineSeparator: String
23-
get() = "\n"
24-
2519
/**
2620
* Read the contents of a file as a [String] or return null on any error.
2721
*

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/Platform.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public interface PlatformProvider :
3636
internal expect object SystemDefaultProvider : PlatformProvider {
3737
override fun osInfo(): OperatingSystem
3838
override val filePathSeparator: String
39-
override val lineSeparator: String
4039
override fun fileExists(path: String): Boolean
4140
override fun getAllEnvVars(): Map<String, String>
4241
override fun getAllProperties(): Map<String, String>
@@ -51,14 +50,17 @@ internal expect object SystemDefaultProvider : PlatformProvider {
5150
override val isNative: Boolean
5251
}
5352

54-
internal val OperatingSystem.lineSeparator: String
53+
public data class OperatingSystem(val family: OsFamily, val version: String?)
54+
55+
/**
56+
* The string which represents a line separator on this file system. For example, on Windows, this is CRLF.
57+
*/
58+
public val OperatingSystem.lineSeparator: String
5559
get() = when {
5660
family == OsFamily.Windows -> "\r\n"
5761
else -> "\n"
5862
}
5963

60-
public data class OperatingSystem(val family: OsFamily, val version: String?)
61-
6264
public enum class OsFamily {
6365
Linux,
6466
MacOs,

runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/util/PlatformJVM.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ internal actual object SystemDefaultProvider : PlatformProvider {
7171
* segment char is '/'.
7272
*/
7373
actual override val filePathSeparator: String by lazy { File.separator }
74-
75-
actual override val lineSeparator: String by lazy { osInfo().lineSeparator }
7674
}
7775

7876
private fun isAndroid(): Boolean = try {

runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/util/PlatformNative.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ internal actual object SystemDefaultProvider : PlatformProvider {
1616
actual override val filePathSeparator: String
1717
get() = TODO("Not yet implemented")
1818

19-
actual override val lineSeparator: String
20-
get() = TODO("Not yet implemented")
21-
2219
actual override suspend fun readFileOrNull(path: String): ByteArray? {
2320
TODO("Not yet implemented")
2421
}

0 commit comments

Comments
 (0)