Merge branch 'launch_fix' into 'master'

Fix some non-ASCII path issues

Closes #6817

See merge request OpenMW/openmw!2686
7220-lua-add-a-general-purpose-lexical-parser
psi29a 2 years ago
commit a0795ba7ae

@ -6,6 +6,7 @@
#include <components/contentselector/model/contentmodel.hpp>
#include <components/contentselector/model/esmfile.hpp>
#include <components/contentselector/view/contentselector.hpp>
#include <components/files/qtconversion.hpp>
#include <string>
@ -32,7 +33,7 @@ void CSVDoc::FileDialog::addFiles(const std::vector<std::filesystem::path>& data
{
for (auto iter = dataDirs.rbegin(); iter != dataDirs.rend(); ++iter)
{
QString path = QString::fromUtf8(iter->string().c_str());
QString path = Files::pathToQString(*iter);
mSelector->addFiles(path);
}
mSelector->sortFiles();

@ -8,6 +8,7 @@
#include <QDir>
#include <components/esm3/esmreader.hpp>
#include <components/files/qtconversion.hpp>
ContentSelectorModel::ContentModel::ContentModel(QObject* parent, QIcon warningIcon, bool showOMWScripts)
: QAbstractTableModel(parent)
@ -468,7 +469,7 @@ void ContentSelectorModel::ContentModel::addFiles(const QString& path, bool newf
ESM::ESMReader fileReader;
ToUTF8::Utf8Encoder encoder(ToUTF8::calculateEncoding(mEncoding.toStdString()));
fileReader.setEncoder(&encoder);
fileReader.open(std::string(dir.absoluteFilePath(path2).toUtf8().constData()));
fileReader.open(Files::pathFromQString(dir.absoluteFilePath(path2)));
EsmFile* file = new EsmFile(path2);

@ -39,6 +39,14 @@ Log::~Log()
sLock.unlock();
}
Log& Log::operator<<(const std::filesystem::path&& rhs)
{
if (mShouldLog)
std::cout << Files::pathToUnicodeString(std::move(rhs));
return *this;
}
Log& Log::operator<<(std::filesystem::path&& rhs)
{
if (mShouldLog)
@ -55,6 +63,22 @@ Log& Log::operator<<(const std::filesystem::path& rhs)
return *this;
}
Log& Log::operator<<(std::filesystem::path& rhs)
{
if (mShouldLog)
std::cout << Files::pathToUnicodeString(rhs);
return *this;
}
Log& Log::operator<<(const std::u8string&& rhs)
{
if (mShouldLog)
std::cout << Misc::StringUtils::u8StringToString(std::move(rhs));
return *this;
}
Log& Log::operator<<(std::u8string&& rhs)
{
if (mShouldLog)

@ -37,10 +37,16 @@ public:
return *this;
}
Log& operator<<(const std::filesystem::path&& rhs);
Log& operator<<(std::filesystem::path&& rhs);
Log& operator<<(const std::filesystem::path& rhs);
Log& operator<<(std::filesystem::path& rhs);
Log& operator<<(const std::u8string&& rhs);
Log& operator<<(std::u8string&& rhs);
Log& operator<<(std::u8string_view rhs);

Loading…
Cancel
Save