From 59434f93ed91e4252d8ff64bfd28b4f3203572a4 Mon Sep 17 00:00:00 2001 From: Rajiv Shah Date: Mon, 2 May 2022 07:22:08 -0400 Subject: [PATCH] Fix Windows UTF-8 build flag (#623) Co-authored-by: Oleksandr Anyshchenko --- librocksdb-sys/build.rs | 2 +- tests/test_db.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index cfa2fec..48af659 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -171,7 +171,7 @@ fn build_rocksdb() { config.define("_MBCS", None); config.define("WIN64", None); config.define("NOMINMAX", None); - config.define("WITH_WINDOWS_UTF8_FILENAMES", "ON"); + config.define("ROCKSDB_WINDOWS_UTF8_FILENAMES", None); if &target == "x86_64-pc-windows-gnu" { // Tell MinGW to create localtime_r wrapper of localtime_s function. diff --git a/tests/test_db.rs b/tests/test_db.rs index 7aa93aa..2c08993 100644 --- a/tests/test_db.rs +++ b/tests/test_db.rs @@ -618,6 +618,23 @@ fn test_open_with_multiple_refs_as_single_threaded() { t.compile_fail("tests/fail/open_with_multiple_refs_as_single_threaded.rs"); } +#[test] +fn test_open_utf8_path() { + let path = DBPath::new("_rust_rocksdb_utf8_path_temporärer_Ordner"); + + { + let db = DB::open_default(&path).unwrap(); + + assert!(db.put(b"k1", b"v1111").is_ok()); + + let r: Result>, Error> = db.get(b"k1"); + + assert_eq!(r.unwrap().unwrap(), b"v1111"); + assert!(db.delete(b"k1").is_ok()); + assert!(db.get(b"k1").unwrap().is_none()); + } +} + #[test] fn compact_range_test() { let path = DBPath::new("_rust_rocksdb_compact_range_test");