react-native-mmkv icon indicating copy to clipboard operation
react-native-mmkv copied to clipboard

Path config with `~` on macOS seems to not work

Open Simek opened this issue 2 years ago • 1 comments

Lately, I have switched from AsyncStorage to MMKV in on of the macOS test projects, and I would like to utilize the path config, but it looks like that, when path includes tilde (~) file is not saved. Not sure if this is intended to work, but I have decided to report this anyway, so feel free to close this one or convert to feature request.

Other thing which was a bit unexpected is that you cannot use the constructor with config object, but without the id field (no fallback to default?), so for example when path and encryption field are the only present, this leads to error about missing ID.

Repro

  • Clone: https://github.com/Simek/react-native-macos-reminders
  • Edit: https://github.com/Simek/react-native-macos-reminders/blob/master/src/Storage.js
  • Add: path: '~/.test' config option

Simek avatar Mar 09 '22 10:03 Simek

Hey Bartosz!

  1. I'll take a look! Maybe this issue should be reported in the original MMKV repo instead?
  2. Yeah well ID cannot be default anymore since the default instance does not have encryption or custom path. So when you supply any of those, you have to use a different ID.

mrousavy avatar Mar 10 '22 11:03 mrousavy