IllegalArgumentException: File contains a path separator - Cannot create sqldelight file on ios application group directory
See original GitHub issueI’m trying to create the sqlite file on iOS in the application group directory so it can be shared between the main app and the today notification center widget. I’ve created sqlite files and shared it successfully this way in the past, just not using sqldelight.
let url = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.identifier")!
let file = url.path + "/" + Schema.FILE_NAME
val dbConfig = DatabaseConfiguration(
name = file,
version = Schema.version,
foreignKeyConstraints = true,
create = { connection ->
wrapConnection(connection) { Schema.create(it) }
},
upgrade = { connection, oldVersion, newVersion ->
wrapConnection(connection) { Schema.migrate(it, oldVersion, newVersion) }
}
)
return NativeSqliteDriver(
dbConfig)
Runtime Environment SQLDelight version: 1.3.0 Application OS: iOS
Describe the bug
Exception:
Uncaught Kotlin exception: kotlin.IllegalArgumentException: File
/Users/username/Library/Developer/CoreSimulator/Devices/63D82DB4-4A53-4931-906C-BB63480D651C/data/Containers/Shared/AppGroup/23F1DE03-88A2-4840-BB83-037915A442B9/db contains a path separator
It seems in DatabaseConfiguration there is a hard requirement that the sqlite file doesn’t contain path separators:
if (name.contains("/")) {
throw IllegalArgumentException(
"File $name contains a path separator"
)
}
Putting the sqlite file in the application group directory is a pretty common scenario to share data with extensions - is there any way to do this? Can this path check be removed? Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
java.lang.IllegalArgumentException: contains a path separator
The solution is: FileInputStream fis = new FileInputStream (new File(NAME_OF_FILE)); // 2nd line. The openFileInput method doesn't accept path separators.
Read more >Android : java.lang.IllegalArgumentException File contains a ...
How to resolve java.lang.IllegalArgumentException: File /Dir/data.txt contains a path separator error.
Read more >Home | KMPizza - Lena Stepanova - Android Developer
Step 27: Add a local database to KMM Android and iOS app with SQLDelight ... Android and iOS apps. Go to the shared...
Read more >GraphQL and Android FINAL Version - CommonsWare
clients: Web apps, Android apps, iOS apps, other servers, etc. ... If you have your GraphQL in a dedicated document file, you might...
Read more >Kotlin Language Documentation 1.7.21
iOS app. Create a multiplatform app using Ktor and SQLDelight – tutorial ... Converting an existing Java file to Kotlin with J2K.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Path should be