Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stores on desktop targets requires the folder to be created ahead of file writes/reads #103

Open
xxfast opened this issue May 11, 2024 · 0 comments
Milestone

Comments

@xxfast
Copy link
Owner

xxfast commented May 11, 2024

Creating a store for android/ios is fairly straightforward

//android
val filesDir: String = androidContext().filesDir.path
storeOf(file = "$filesDir/countries.json".toPath(), default = emptyList())
        
// ios
val filesDir: String? = NSFileManager.defaultManager.DocumentDirectory?.relativePath
requireNotNull(filesDir) { "Document directory not found" }
storeOf(file = "$filesDir/countries.json".toPath(), default = emptyList())

However, for desktop we need this extra step

// desktop
val filesDir: String = AppDirsFactory.getInstance()
            .getUserDataDir(PACKAGE_NAME, VERSION, AUTHOR)

FILE_SYSTEM.createDirectories(filesDir.toPath())

storeOf(file = "$filesDir/countries.json".toPath(), default = emptyList())

Need to think of an API to bridge this gap

@xxfast xxfast added this to the Release 1.0.0 milestone May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant