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

Delete Setting API #205

Open
SaeedZhiany opened this issue Sep 23, 2024 · 2 comments
Open

Delete Setting API #205

SaeedZhiany opened this issue Sep 23, 2024 · 2 comments

Comments

@SaeedZhiany
Copy link

SaeedZhiany commented Sep 23, 2024

Is there any delete API that completely deletes the underlying key-value storage? What I'm looking for is different from the API clear, I don't want to clear all key values within the storage, but remove the storage itself.

for example, we can use this code:

Android:

context.deleteSharedPreferences("STORAGE_NAME")

Windows:

fun remove() = memScoped {
    val hkey = alloc<HKEYVar>()
    try {
        RegDeleteKeyExW(
            HKEY_CURRENT_USER,
            rootKeyName,
            (KEY_READ or KEY_WRITE).toUInt(),
            0u,
        ).checkWinApiSuccess { "Unable to create/open registry key for \"$rootKeyName\"" }
    } finally {
    }
}

and similarly, I expect such functionality should be available in the other platforms, so we can use them and implement the API in the library.

If it's not included in this library, is there any plan to support such functionality?

Thanks

@russhwolf
Copy link
Owner

There's no API for this currently. It's not a need that I'm very aware of. Can you say more about your use-case and why clear() isn't enough?

@SaeedZhiany
Copy link
Author

I'm working on a Kotlin Multiplatform application that needs to dynamically create many temporary key-value storages (KVS) as the user demands and then remove the file because I don't want to keep many empty KVS on users' devices. so I'm looking for an approach to delete the storage instead of clearing its content.

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

2 participants