bevy_pkv icon indicating copy to clipboard operation
bevy_pkv copied to clipboard

Paths and how to work with it?

Open Gavolot opened this issue 1 year ago • 5 comments

It's not exactly a mistake. But I read the documentation and didn’t understand anything about how to work with them.

Your library is working. But I don’t understand how I can, for example, “delete” the database for tests.

Because now I can’t do this, because I don’t know where it is in Windows. I'm exclusively making a PC game.

Gavolot avatar Feb 05 '24 01:02 Gavolot

It's important to clarify, I'm relatively new to Rust, but not new to programming.

Gavolot avatar Feb 05 '24 01:02 Gavolot

The point of this library is that you should not have to think about paths, it's just created in the right directory.

There is a clear method, does this do what you want to do?

On windows, the db is created somewhere inside appdata

johanhelsing avatar Feb 05 '24 06:02 johanhelsing

yes, I wanted to simulate a situation where the “User” deleted the database or decided to transfer the “saves” to another computer

Gavolot avatar Feb 07 '24 05:02 Gavolot

I found where it is by default in Windows. I had already forgotten that Windows has a “recently changed” filter and the ability to sort by date.

My last question is, can I somehow force the database to be saved in the game's .exe directory?

Gavolot avatar Feb 08 '24 06:02 Gavolot

Hmm... have you considered just using redb directly? Apart from figuring out the correct paths for your platform and serialization, this crate adds very little on top. It's intended as a zero configuration-needed crate.

But yeah, you could create it in a specific directory: https://docs.rs/bevy_pkv/latest/bevy_pkv/struct.PkvStore.html#method.new_in_dir

See https://github.com/johanhelsing/bevy_pkv/blob/main/src/redb_store.rs if you'd rather use redb directly.

johanhelsing avatar Feb 08 '24 09:02 johanhelsing