You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently attempting to implement a POC of this library into an Android app. Currently, it will fail when doing instrumented tests or running the app when trying to create the home directory. It seems to check for the JVM user.home directory which on Android isn't a valid write spot as app's storage are segmented from the regular phone's storage. Is there any way to pass a custom path instead? Ideally we should be able to pass a custom home directory like /data/data/<package-name>/.roboquant on Android
Here is the stack trace of the failure if it helps:
java.nio.file.FileSystemException: .roboquant: Read-only file system
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:404)
at java.nio.file.Files.createDirectory(Files.java:674)
at org.roboquant.common.Config$home$2.invoke(Config.kt:150)
at org.roboquant.common.Config$home$2.invoke(Config.kt:147)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at org.roboquant.common.Config.getHome(Config.kt:147)
at org.roboquant.common.Config.getEnv(Config.kt:218)
at org.roboquant.common.Config.getProperty(Config.kt:201)
at org.roboquant.common.Config.getProperty(Config.kt:173)
The text was updated successfully, but these errors were encountered:
I guess this is the offending code in the Config class:
val home:Path by lazy {
val path:Path=Paths.get(System.getProperty("user.home"), ".roboquant")
if (Files.notExists(path)) {
Files.createDirectory(path)
logger.trace { "Created new home directory $path" }
}
path
}
One solution could be to check for another property first (like "roboquant.home") that would supersede this default implementation. Something like:
val home:Path by lazy {
val roboquantHome = getProperty("roboquant.home")
val path =if (roboquantHome !=null) Paths.get(roboquantHome) elsePaths.get(System.getProperty("user.home"), ".roboquant")
if (Files.notExists(path)) {
Files.createDirectory(path)
logger.trace { "Created new home directory $path" }
}
path
}
I guess this is the offending code in the Config class:
val home:Path by lazy {
val path:Path=Paths.get(System.getProperty("user.home"), ".roboquant")
if (Files.notExists(path)) {
Files.createDirectory(path)
logger.trace { "Created new home directory $path" }
}
path
}
One solution could be to check for another property first (like "roboquant.home") that would supersede this default implementation. Something like:
val home:Path by lazy {
val roboquantHome = getProperty("roboquant.home")
val path =if (roboquantHome !=null) Paths.get(roboquantHome) elsePaths.get(System.getProperty("user.home"), ".roboquant")
if (Files.notExists(path)) {
Files.createDirectory(path)
logger.trace { "Created new home directory $path" }
}
path
}
That's a great idea, would just have to update docs for this as well. Much easier than passing a path in for everything that uses the Config class haha.
Currently attempting to implement a POC of this library into an Android app. Currently, it will fail when doing instrumented tests or running the app when trying to create the home directory. It seems to check for the JVM
user.home
directory which on Android isn't a valid write spot as app's storage are segmented from the regular phone's storage. Is there any way to pass a custom path instead? Ideally we should be able to pass a custom home directory like/data/data/<package-name>/.roboquant
on AndroidHere is the stack trace of the failure if it helps:
The text was updated successfully, but these errors were encountered: