mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-13 15:15:21 +08:00
Correctly open files with non-ASCII paths on Windows
This fixes #976, fixes #974, fixes #444. On Windows the standard stream open() functions expect bytes encoded in current system encoding, not UTF8. Since we're dealing with UTF8 throughout the application this results in wrong paths being passed and failure to open files. As a solution, we convert the paths to UTF16 via the WCHAR character type and use the special Windows-specific overloads of open() functions.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "base/Log.h"
|
||||
#include "base/String.h"
|
||||
#include "common/DataDirectories.h"
|
||||
#include "io/fstream.h"
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
@@ -708,7 +709,7 @@ SecureSocket::verifyCertFingerprint()
|
||||
// check if this fingerprint exist
|
||||
std::string fileLine;
|
||||
std::ifstream file;
|
||||
file.open(trustedServersFilename.c_str());
|
||||
barrier::open_utf8_path(file, trustedServersFilename);
|
||||
|
||||
if (!file.is_open()) {
|
||||
LOG((CLOG_NOTE "Unable to open trustedServersFile: %s", trustedServersFilename.c_str() ));
|
||||
|
||||
Reference in New Issue
Block a user