Skip to content

Commit

Permalink
Fix can't use in Thai path.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwon committed Mar 17, 2017
1 parent 7e1aa93 commit d95b882
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions openstudiocore/src/litesql/library/sqlite3_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "compatibility.hpp"
#include "sqlite3.hpp"
#include "sqlite3.h"
#include <QString>

#include <string>
#ifdef HAVE_LIBSQLITE3
Expand Down Expand Up @@ -89,8 +90,9 @@ SQLite3::SQLite3(const string& connInfo) : db(NULL), transaction(false) {
if (database.empty())
throw DatabaseError("no database-param specified");

if (sqlite3_open(database.c_str(), &db)) {
throw DatabaseError(sqlite3_errmsg(db));
QString f8bit = QString::fromLocal8Bit(database.c_str());
if (sqlite3_open(f8bit.toUtf8().constData(), &db)) {
throw DatabaseError(sqlite3_errmsg(db));
}

}
Expand Down
2 changes: 1 addition & 1 deletion openstudiocore/src/openstudio_lib/OSDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ OSDocument::OSDocument( openstudio::model::Model library,
if (!m_simpleProject) {
LOG(Debug, "Creating new project");
m_simpleProject = openstudio::analysisdriver::SimpleProject::create(
openstudio::toPath(m_modelTempDir) / openstudio::toPath("resources"),
modelTempDir / openstudio::toPath("resources"),
options,
true);

Expand Down
2 changes: 1 addition & 1 deletion openstudiocore/src/utilities/core/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::string toString(const path& p)
/** path to QString. */
QString toQString(const path& p)
{
return toQString(toString(p));
return QString::fromLocal8Bit(p.string().c_str());
}

/** UTF-8 encoded char* to path*/
Expand Down
2 changes: 1 addition & 1 deletion openstudiocore/src/utilities/core/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ std::string toString(const std::wstring& w)
/** QString to UTF-8 encoded std::string. */
std::string toString(const QString& q)
{
const QByteArray& qb = q.toUtf8();
const QByteArray& qb = q.toLocal8Bit();
return std::string(qb.data());
}

Expand Down

0 comments on commit d95b882

Please sign in to comment.