File tree Expand file tree Collapse file tree 7 files changed +5
-30
lines changed Expand file tree Collapse file tree 7 files changed +5
-30
lines changed Original file line number Diff line number Diff line change 5
5
6
6
package kotlinx.io
7
7
8
+ import kotlinx.io.files.FileSystem
8
9
import kotlinx.io.files.Path
9
10
import kotlinx.io.files.sink
10
11
import platform.Foundation.NSInputStream
@@ -38,7 +39,7 @@ class NSInputStreamSourceTest {
38
39
assertEquals(7 , source.readAtMostTo(buffer, 10 ))
39
40
assertEquals(" example" , buffer.readString())
40
41
} finally {
41
- deleteFile( file)
42
+ FileSystem . System .delete( Path ( file) )
42
43
}
43
44
}
44
45
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ public expect fun Path.source(): Source
110
110
* overwrites contents.
111
111
*/
112
112
@Deprecated(
113
- message = " Use FileSystem.sink instead" ,
113
+ message = " Use FileSystem.write instead" ,
114
114
replaceWith = ReplaceWith (
115
115
expression = " FileSystem.System.write(this)" ,
116
116
imports = arrayOf(" kotlinx.io.files.FileSystem" )
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ fun assertNoEmptySegments(buffer: Buffer) {
40
40
}
41
41
42
42
expect fun tempFileName (): String
43
- expect fun deleteFile (path : String )
44
43
45
44
private fun fromHexChar (char : Char ): Int {
46
45
val code = char.code
Original file line number Diff line number Diff line change @@ -47,10 +47,3 @@ actual fun tempFileName(): String {
47
47
return fullpath
48
48
}
49
49
}
50
-
51
- actual fun deleteFile (path : String ) {
52
- if (! fs.existsSync(path) as Boolean ) {
53
- throw IOException (" File does not exist: $path " )
54
- }
55
- fs.rmSync(path)
56
- }
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ package kotlinx.io
6
6
7
7
import kotlinx.io.files.FileSystem
8
8
import java.io.File
9
- import java.nio.file.Files
10
- import java.nio.file.Paths
11
9
import kotlin.random.Random
12
10
import kotlin.test.assertEquals
13
11
@@ -23,13 +21,6 @@ actual fun tempFileName(): String {
23
21
}
24
22
}
25
23
26
- actual fun deleteFile (path : String ) {
27
- if (! Files .isRegularFile(Paths .get(path))) {
28
- throw IllegalArgumentException (" Path is not a file: $path ." )
29
- }
30
- Files .delete(Paths .get(path))
31
- }
32
-
33
24
fun assertByteArrayEquals (expectedUtf8 : String , b : ByteArray ) {
34
25
assertEquals(expectedUtf8, b.toString(Charsets .UTF_8 ))
35
26
}
Original file line number Diff line number Diff line change 8
8
package kotlinx.io
9
9
10
10
import kotlinx.cinterop.UnsafeNumber
11
- import kotlinx.cinterop.toKString
12
11
import kotlinx.io.files.FileSystem
13
- import platform.posix.*
12
+ import platform.posix.F_OK
13
+ import platform.posix.access
14
14
import kotlin.random.Random
15
15
16
16
@OptIn(UnsafeNumber ::class , ExperimentalStdlibApi ::class )
@@ -25,10 +25,3 @@ actual fun tempFileName(): String {
25
25
}
26
26
throw IOException (" Failed to generate temp file name" )
27
27
}
28
-
29
- actual fun deleteFile (path : String ) {
30
- if (access(path, F_OK ) != 0 ) throw IOException (" File does not exist: $path " )
31
- if (remove(path) != 0 ) {
32
- throw IOException (" Failed to delete file $path : ${strerror(errno)?.toKString()} " )
33
- }
34
- }
Original file line number Diff line number Diff line change @@ -8,5 +8,3 @@ package kotlinx.io
8
8
import kotlinx.io.files.unsupported
9
9
10
10
actual fun tempFileName (): String = unsupported()
11
-
12
- actual fun deleteFile (path : String ): Unit = unsupported()
You can’t perform that action at this time.
0 commit comments