aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs.h7
-rw-r--r--src/wallet/wallet.cpp2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/fs.h b/src/fs.h
index c179be7607..9f18794539 100644
--- a/src/fs.h
+++ b/src/fs.h
@@ -92,6 +92,13 @@ static inline path operator+(path p1, path p2)
return p1;
}
+// Disallow implicit std::string conversion for copy_file
+// to avoid locale-dependent encoding on Windows.
+static inline void copy_file(const path& from, const path& to, copy_option options)
+{
+ boost::filesystem::copy_file(from, to, options);
+}
+
/**
* Convert path object to byte string. On POSIX, paths natively are byte
* strings, so this is trivial. On Windows, paths natively are Unicode, so an
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 267710e8c7..3acf4a84c9 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -377,7 +377,7 @@ std::shared_ptr<CWallet> RestoreWallet(WalletContext& context, const std::string
}
auto wallet_file = wallet_path / "wallet.dat";
- fs::copy_file(backup_file, wallet_file, fs::copy_option::fail_if_exists);
+ fs::copy_file(fs::u8path(backup_file), wallet_file, fs::copy_option::fail_if_exists);
auto wallet = LoadWallet(context, wallet_name, load_on_start, options, status, error, warnings);