Skip to content

Commit

Permalink
add macos loadMetadata hack
Browse files Browse the repository at this point in the history
  • Loading branch information
luca992 committed Dec 2, 2024
1 parent 541240e commit cce47a3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ import platform.Foundation.NSFileManager
class ComposeResourceMetadataLoader : MetadataLoader {
override fun loadMetadata(phoneMetadataResource: String): InputStream? {
return try {
val path = Res.getUri(phoneMetadataResource).removePrefix("file://")
val fm = NSFileManager.defaultManager()
val currentDirectoryPath = fm.currentDirectoryPath
println("currentDirectoryPath: $currentDirectoryPath")
val path = if (currentDirectoryPath.endsWith("/sample")) {
// hack for macos
getPathOnDisk(phoneMetadataResource)
} else {
Res.getUri(phoneMetadataResource).removePrefix("file://")
}
println("loadMetadata path: $path")
OkioInputStream(FileSystem.SYSTEM.source(path.toPath()).buffer())
} catch (t: Throwable) {
logger.v("Failed to load metadata from $phoneMetadataResource", t)
Expand Down

0 comments on commit cce47a3

Please sign in to comment.