Windows: deal with non-ASCII user login, non-ascii paths in confdir etc.

This commit is contained in:
Jean-Francois Dockes
2020-04-15 14:03:04 +01:00
parent 7c39eff719
commit 12ebb7ac6e
10 changed files with 201 additions and 92 deletions
+5 -4
View File
@@ -28,6 +28,7 @@
#include <algorithm>
#include <sstream>
#include <iostream>
#include <fstream>
using namespace std;
@@ -283,12 +284,12 @@ void Db::Native::openWrite(const string& dir, Db::OpenMode mode)
// Force Chert format, don't store the text.
string stub = path_cat(m_rcldb->m_config->getConfDir(),
"xapian.stub");
FILE *fp = fopen(stub.c_str(), "w");
if (nullptr == fp) {
std::fstream fp = path_open(stub, std::ios::out|std::ios::trunc);
if (!fp.is_open()) {
throw(string("Can't create ") + stub);
}
fprintf(fp, "chert %s\n", dir.c_str());
fclose(fp);
fp << "chert " << dir << "\n";
fp.close();
xwdb = Xapian::WritableDatabase(stub, action);
m_storetext = false;
}