File tree Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Expand file tree Collapse file tree 4 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,13 @@ kotlin {
5757 val macosArm64Main by getting {
5858 dependsOn(posixMain)
5959 if (testApp?.toBoolean() == true ) {
60- kotlin.srcDirs(" src/macosX64Runner /kotlin" )
60+ kotlin.srcDirs(" src/macosRunner /kotlin" )
6161 }
6262 }
6363 val macosX64Main by getting {
6464 dependsOn(posixMain)
6565 if (testApp?.toBoolean() == true ) {
66- kotlin.srcDirs(" src/macosX64Runner /kotlin" )
66+ kotlin.srcDirs(" src/macosRunner /kotlin" )
6767 }
6868 }
6969 val linuxX64Main by getting {
Original file line number Diff line number Diff line change 1+ package me.archinamon.fileio
2+
3+ import kotlinx.cinterop.CPointed
4+ import kotlinx.cinterop.CPointer
5+ import kotlinx.cinterop.alloc
6+ import kotlinx.cinterop.convert
7+ import kotlinx.cinterop.memScoped
8+ import kotlinx.cinterop.ptr
9+ import platform.posix.DIR
10+ import platform.posix.dirent
11+ import platform.posix.stat
12+
13+ internal actual fun stat.checkFileIs (flag : Int ): Boolean = (st_mode.convert<Int >() and flag) == flag
14+
15+ internal actual fun mkdir (path : String , mode : UInt ): Int = platform.posix.mkdir(path, mode.convert())
16+
17+ internal actual fun opendir (path : String ): CPointer <out CPointed >? = platform.posix.opendir(path)
18+
19+ @Suppress(" UNCHECKED_CAST" )
20+ internal actual fun readdir (dir : CPointer <out CPointed >): CPointer <dirent>? = platform.posix.readdir(dir as CPointer <DIR >)
21+
22+ @Suppress(" UNCHECKED_CAST" )
23+ internal actual fun closedir (dir : CPointer <out CPointed >): Int = platform.posix.closedir(dir as CPointer <DIR >)
24+
25+ internal actual fun modified (file : File ): Long = memScoped {
26+ val result = alloc< stat> ()
27+ if (stat(file.getAbsolutePath(), result.ptr) != 0 ) {
28+ return 0L
29+ }
30+
31+ result.st_mtimespec.tv_sec
32+ }
Original file line number Diff line number Diff line change 1+ package me.archinamon.fileio
2+
3+ actual fun platform (): Platform = Platform .Macos
File renamed without changes.
You can’t perform that action at this time.
0 commit comments