mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 20:39:40 +00:00
Fix some remaining encoding errors due to std::filesystem transition.
This commit is contained in:
parent
1fc197e404
commit
c226b35f1f
22 changed files with 56 additions and 57 deletions
|
@ -244,7 +244,7 @@ int extractAll(std::unique_ptr<File>& bsa, Arguments& info)
|
||||||
|
|
||||||
// Get the target path (the path the file will be extracted to)
|
// Get the target path (the path the file will be extracted to)
|
||||||
auto target = info.outdir;
|
auto target = info.outdir;
|
||||||
target /= extractPath;
|
target /= Misc::StringUtils::stringToU8String(extractPath);
|
||||||
|
|
||||||
// Create the directory hierarchy
|
// Create the directory hierarchy
|
||||||
std::filesystem::create_directories(target.parent_path());
|
std::filesystem::create_directories(target.parent_path());
|
||||||
|
@ -261,7 +261,7 @@ int extractAll(std::unique_ptr<File>& bsa, Arguments& info)
|
||||||
std::ofstream out(target, std::ios::binary);
|
std::ofstream out(target, std::ios::binary);
|
||||||
|
|
||||||
// Write the file to disk
|
// Write the file to disk
|
||||||
std::cout << "Extracting " << target << std::endl;
|
std::cout << "Extracting " << Files::pathToUnicodeString(target) << std::endl;
|
||||||
out << data->rdbuf();
|
out << data->rdbuf();
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ void loadCell(const Arguments& info, ESM::Cell &cell, ESM::ESMReader &esm, ESMDa
|
||||||
|
|
||||||
void printRawTes3(const std::filesystem::path &path)
|
void printRawTes3(const std::filesystem::path &path)
|
||||||
{
|
{
|
||||||
std::cout << "TES3 RAW file listing: " << path << '\n';
|
std::cout << "TES3 RAW file listing: " << Files::pathToUnicodeString(path) << '\n';
|
||||||
ESM::ESMReader esm;
|
ESM::ESMReader esm;
|
||||||
esm.openRaw(path);
|
esm.openRaw(path);
|
||||||
while(esm.hasMoreRecs())
|
while(esm.hasMoreRecs())
|
||||||
|
|
|
@ -345,7 +345,7 @@ namespace ESSImport
|
||||||
|
|
||||||
writer.setFormat (ESM::SavedGame::sCurrentFormat);
|
writer.setFormat (ESM::SavedGame::sCurrentFormat);
|
||||||
|
|
||||||
std::ofstream stream(std::filesystem::path(mOutFile), std::ios::out | std::ios::binary);
|
std::ofstream stream(mOutFile, std::ios::out | std::ios::binary);
|
||||||
// all unused
|
// all unused
|
||||||
writer.setVersion(0);
|
writer.setVersion(0);
|
||||||
writer.setType(0);
|
writer.setType(0);
|
||||||
|
|
|
@ -232,7 +232,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
|
|
||||||
const auto& globalDataDir = mGameSettings.getGlobalDataDir();
|
const auto& globalDataDir = mGameSettings.getGlobalDataDir();
|
||||||
if (!globalDataDir.empty())
|
if (!globalDataDir.empty())
|
||||||
directories.insert(0, QString::fromStdWString(globalDataDir.wstring()));
|
directories.insert(0, QString::fromStdU32String(globalDataDir.u32string()));
|
||||||
|
|
||||||
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
|
// normalize user supplied directories: resolve symlink, convert to native separator, make absolute
|
||||||
for (auto& currentDir : directories)
|
for (auto& currentDir : directories)
|
||||||
|
@ -264,7 +264,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// deactivate data-local and global data directory: they are always included
|
// deactivate data-local and global data directory: they are always included
|
||||||
if (currentDir == mDataLocal || std::filesystem::path(currentDir.toStdWString()) == globalDataDir)
|
if (currentDir == mDataLocal || std::filesystem::path(currentDir.toStdU32String()) == globalDataDir)
|
||||||
{
|
{
|
||||||
auto flags = item->flags();
|
auto flags = item->flags();
|
||||||
item->setFlags(flags & ~(Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled));
|
item->setFlags(flags & ~(Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled));
|
||||||
|
|
|
@ -163,7 +163,7 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
|
||||||
cfgError(tr("Error opening OpenMW configuration file"),
|
cfgError(tr("Error opening OpenMW configuration file"),
|
||||||
tr("<br><b>Could not create directory %0</b><br><br> \
|
tr("<br><b>Could not create directory %0</b><br><br> \
|
||||||
Please make sure you have the right permissions \
|
Please make sure you have the right permissions \
|
||||||
and try again.<br>").arg(QString::fromStdWString(canonical(userConfigDir).wstring()))
|
and try again.<br>").arg(QString::fromStdU32String(canonical(userConfigDir).u32string()))
|
||||||
);
|
);
|
||||||
return FirstRunDialogResultFailure;
|
return FirstRunDialogResultFailure;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
||||||
|
|
||||||
mLauncherSettings.setMultiValueEnabled(true);
|
mLauncherSettings.setMultiValueEnabled(true);
|
||||||
|
|
||||||
QString userPath = QString::fromStdWString(mCfgMgr.getUserConfigPath().wstring());
|
QString userPath = QString::fromStdU32String(mCfgMgr.getUserConfigPath().u32string());
|
||||||
|
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
paths.append(QString(Config::LauncherSettings::sLauncherConfigFileName));
|
paths.append(QString(Config::LauncherSettings::sLauncherConfigFileName));
|
||||||
|
@ -329,9 +329,9 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||||
{
|
{
|
||||||
mGameSettings.clear();
|
mGameSettings.clear();
|
||||||
|
|
||||||
QString localPath = QString::fromStdWString(mCfgMgr.getLocalPath().wstring());
|
QString localPath = QString::fromStdU32String(mCfgMgr.getLocalPath().u32string());
|
||||||
QString userPath = QString::fromStdWString(mCfgMgr.getUserConfigPath().wstring());
|
QString userPath = QString::fromStdU32String(mCfgMgr.getUserConfigPath().u32string());
|
||||||
QString globalPath = QString::fromStdWString(mCfgMgr.getGlobalPath().wstring());
|
QString globalPath = QString::fromStdU32String(mCfgMgr.getGlobalPath().u32string());
|
||||||
|
|
||||||
QFile file;
|
QFile file;
|
||||||
|
|
||||||
|
@ -487,13 +487,13 @@ bool Launcher::MainDialog::writeSettings()
|
||||||
cfgError(tr("Error creating OpenMW configuration directory"),
|
cfgError(tr("Error creating OpenMW configuration directory"),
|
||||||
tr("<br><b>Could not create %0</b><br><br> \
|
tr("<br><b>Could not create %0</b><br><br> \
|
||||||
Please make sure you have the right permissions \
|
Please make sure you have the right permissions \
|
||||||
and try again.<br>").arg(QString::fromStdWString(userPath.wstring())));
|
and try again.<br>").arg(QString::fromStdU32String(userPath.u32string())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Game settings
|
// Game settings
|
||||||
QFile file(QString::fromStdWString((userPath / "openmw.cfg").wstring()));
|
QFile file(QString::fromStdU32String((userPath / "openmw.cfg").u32string()));
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||||
// File cannot be opened or created
|
// File cannot be opened or created
|
||||||
|
@ -521,7 +521,7 @@ bool Launcher::MainDialog::writeSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Launcher settings
|
// Launcher settings
|
||||||
file.setFileName(QString::fromStdWString((userPath / Config::LauncherSettings::sLauncherConfigFileName).wstring()));
|
file.setFileName(QString::fromStdU32String((userPath / Config::LauncherSettings::sLauncherConfigFileName).u32string()));
|
||||||
|
|
||||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
|
if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
|
||||||
// File cannot be opened or created
|
// File cannot be opened or created
|
||||||
|
|
|
@ -104,7 +104,7 @@ void Launcher::SettingsPage::on_importerButton_clicked()
|
||||||
// Create the file if it doesn't already exist, else the importer will fail
|
// Create the file if it doesn't already exist, else the importer will fail
|
||||||
auto path = mCfgMgr.getUserConfigPath();
|
auto path = mCfgMgr.getUserConfigPath();
|
||||||
path /= "openmw.cfg";
|
path /= "openmw.cfg";
|
||||||
QFile file(QString::fromStdWString(path.wstring()));
|
QFile file(QString::fromStdU32String(path.u32string()));
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
if (!file.open(QIODevice::ReadWrite)) {
|
if (!file.open(QIODevice::ReadWrite)) {
|
||||||
|
@ -137,7 +137,7 @@ void Launcher::SettingsPage::on_importerButton_clicked()
|
||||||
arguments.append(QString("--ini"));
|
arguments.append(QString("--ini"));
|
||||||
arguments.append(settingsComboBox->currentText());
|
arguments.append(settingsComboBox->currentText());
|
||||||
arguments.append(QString("--cfg"));
|
arguments.append(QString("--cfg"));
|
||||||
arguments.append(QString::fromStdWString(path.wstring()));
|
arguments.append(QString::fromStdU32String(path.u32string()));
|
||||||
|
|
||||||
qDebug() << "arguments " << arguments;
|
qDebug() << "arguments " << arguments;
|
||||||
|
|
||||||
|
|
|
@ -658,7 +658,7 @@ void MwIniImporter::setVerbose(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::filesystem::path& filename) const {
|
MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::filesystem::path& filename) const {
|
||||||
std::cout << "load ini file: " << filename << std::endl;
|
std::cout << "load ini file: " << Files::pathToUnicodeString(filename) << std::endl;
|
||||||
|
|
||||||
std::string section("");
|
std::string section("");
|
||||||
MwIniImporter::multistrmap map;
|
MwIniImporter::multistrmap map;
|
||||||
|
@ -719,7 +719,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::filesystem::pat
|
||||||
}
|
}
|
||||||
|
|
||||||
MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::path& filename) {
|
MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::filesystem::path& filename) {
|
||||||
std::cout << "load cfg file: " << filename << std::endl;
|
std::cout << "load cfg file: " << Files::pathToUnicodeString(filename) << std::endl;
|
||||||
|
|
||||||
MwIniImporter::multistrmap map;
|
MwIniImporter::multistrmap map;
|
||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
|
@ -872,7 +872,7 @@ void MwIniImporter::addPaths(std::vector<std::filesystem::path>& output, std::ve
|
||||||
// Drop first and last characters - quotation marks
|
// Drop first and last characters - quotation marks
|
||||||
path = path.substr(1, path.size() - 2);
|
path = path.substr(1, path.size() - 2);
|
||||||
}
|
}
|
||||||
output.emplace_back(path);
|
output.emplace_back(Files::pathFromUnicodeString(path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
#include <components/files/conversion.hpp>
|
||||||
|
|
||||||
namespace bpo = boost::program_options;
|
namespace bpo = boost::program_options;
|
||||||
namespace sfs = std::filesystem;
|
namespace sfs = std::filesystem;
|
||||||
|
@ -137,7 +138,7 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||||
importer.importArchives(cfg, ini);
|
importer.importArchives(cfg, ini);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "write to: " << outputFile << std::endl;
|
std::cout << "write to: " << Files::pathToUnicodeString(outputFile) << std::endl;
|
||||||
std::ofstream file(outputFile);
|
std::ofstream file(outputFile);
|
||||||
importer.writeToFile(file, cfg);
|
importer.writeToFile(file, cfg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ void CS::Editor::openFiles (const std::filesystem::path &savePath, const std::ve
|
||||||
if(discoveredFiles.empty())
|
if(discoveredFiles.empty())
|
||||||
{
|
{
|
||||||
for (const QString &path : mFileDialog.selectedFilePaths())
|
for (const QString &path : mFileDialog.selectedFilePaths())
|
||||||
files.emplace_back(path.toUtf8().constData());
|
files.emplace_back(path.toStdU32String());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -248,7 +248,7 @@ void CS::Editor::createNewFile (const std::filesystem::path &savePath)
|
||||||
std::vector<std::filesystem::path> files;
|
std::vector<std::filesystem::path> files;
|
||||||
|
|
||||||
for (const QString &path : mFileDialog.selectedFilePaths()) {
|
for (const QString &path : mFileDialog.selectedFilePaths()) {
|
||||||
files.emplace_back(path.toUtf8().constData());
|
files.emplace_back(path.toStdU32String());
|
||||||
}
|
}
|
||||||
|
|
||||||
files.push_back (savePath);
|
files.push_back (savePath);
|
||||||
|
@ -377,23 +377,20 @@ int CS::Editor::run()
|
||||||
|
|
||||||
std::vector<std::filesystem::path> discoveredFiles;
|
std::vector<std::filesystem::path> discoveredFiles;
|
||||||
|
|
||||||
for (std::vector<ESM::Header::MasterData>::const_iterator itemIter = fileReader.getGameFiles().begin();
|
for (const auto& item : fileReader.getGameFiles())
|
||||||
itemIter != fileReader.getGameFiles().end(); ++itemIter)
|
|
||||||
{
|
{
|
||||||
for (Files::PathContainer::const_iterator pathIter = mDataDirs.begin();
|
for (const auto& path : mDataDirs)
|
||||||
pathIter != mDataDirs.end(); ++pathIter)
|
|
||||||
{
|
{
|
||||||
const std::filesystem::path masterPath = *pathIter / itemIter->name;
|
if (auto masterPath = path / item.name; std::filesystem::exists(masterPath))
|
||||||
if (std::filesystem::exists(masterPath))
|
|
||||||
{
|
{
|
||||||
discoveredFiles.push_back(masterPath);
|
discoveredFiles.emplace_back(std::move(masterPath));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
discoveredFiles.push_back(mFileToLoad);
|
discoveredFiles.push_back(mFileToLoad);
|
||||||
|
|
||||||
QString extension = QString::fromStdWString(mFileToLoad.extension().wstring()).toLower();
|
QString extension = QString::fromStdU32String(mFileToLoad.extension().u32string()).toLower();
|
||||||
if (extension == ".esm")
|
if (extension == ".esm")
|
||||||
{
|
{
|
||||||
mFileToLoad.replace_extension(".omwgame");
|
mFileToLoad.replace_extension(".omwgame");
|
||||||
|
|
|
@ -83,17 +83,17 @@ void CSMDoc::Runner::start (bool delayed)
|
||||||
arguments << ("--script-run="+mStartup->fileName());
|
arguments << ("--script-run="+mStartup->fileName());
|
||||||
|
|
||||||
arguments <<
|
arguments <<
|
||||||
QString::fromStdWString (L"--data=\""+mProjectPath.parent_path().wstring()+L"\"");
|
QString::fromStdU32String (U"--data=\""+mProjectPath.parent_path().u32string()+U"\"");
|
||||||
|
|
||||||
arguments << "--replace=content";
|
arguments << "--replace=content";
|
||||||
|
|
||||||
for (const auto & mContentFile : mContentFiles)
|
for (const auto & mContentFile : mContentFiles)
|
||||||
{
|
{
|
||||||
arguments << QString::fromStdWString (L"--content="+mContentFile.wstring());
|
arguments << QString::fromStdU32String (U"--content="+mContentFile.u32string());
|
||||||
}
|
}
|
||||||
|
|
||||||
arguments
|
arguments
|
||||||
<< QString::fromStdWString (L"--content="+mProjectPath.filename().wstring());
|
<< QString::fromStdU32String (U"--content="+mProjectPath.filename().u32string());
|
||||||
|
|
||||||
mProcess.start (path, arguments);
|
mProcess.start (path, arguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,8 +648,7 @@ CSMPrefs::State::~State()
|
||||||
|
|
||||||
void CSMPrefs::State::save()
|
void CSMPrefs::State::save()
|
||||||
{
|
{
|
||||||
std::filesystem::path user = mConfigurationManager.getUserConfigPath() / mConfigFile;
|
Settings::Manager::saveUser (mConfigurationManager.getUserConfigPath() / mConfigFile);
|
||||||
Settings::Manager::saveUser (user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMPrefs::State::Iterator CSMPrefs::State::begin()
|
CSMPrefs::State::Iterator CSMPrefs::State::begin()
|
||||||
|
|
|
@ -68,7 +68,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::filesystem::path path (name.toStdWString());
|
std::filesystem::path path (name.toStdU32String());
|
||||||
|
|
||||||
const auto extension = Misc::StringUtils::lowerCase(path.extension().u8string());
|
const auto extension = Misc::StringUtils::lowerCase(path.extension().u8string());
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||||
if (!isFilePathChanged && !isLegacyPath)
|
if (!isFilePathChanged && !isLegacyPath)
|
||||||
{
|
{
|
||||||
// path already points to the local data directory
|
// path already points to the local data directory
|
||||||
message = QString::fromStdWString (L"Will be saved as: " + path.wstring());
|
message = QString::fromStdU32String (U"Will be saved as: " + path.u32string());
|
||||||
mResultPath = path;
|
mResultPath = path;
|
||||||
}
|
}
|
||||||
//in all other cases, ensure the path points to data-local and do an existing file check
|
//in all other cases, ensure the path points to data-local and do an existing file check
|
||||||
|
@ -95,7 +95,7 @@ void CSVDoc::AdjusterWidget::setName (const QString& name, bool addon)
|
||||||
if (isFilePathChanged)
|
if (isFilePathChanged)
|
||||||
path = mLocalData / path.filename();
|
path = mLocalData / path.filename();
|
||||||
|
|
||||||
message = QString::fromStdWString (L"Will be saved as: " + path.wstring());
|
message = QString::fromStdU32String (U"Will be saved as: " + path.u32string());
|
||||||
mResultPath = path;
|
mResultPath = path;
|
||||||
|
|
||||||
if (std::filesystem::exists (path))
|
if (std::filesystem::exists (path))
|
||||||
|
|
|
@ -19,7 +19,7 @@ void CSVDoc::LoadingDocument::closeEvent (QCloseEvent *event)
|
||||||
CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document)
|
CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document)
|
||||||
: mDocument (document), mTotalRecordsLabel (0), mRecordsLabel (0), mAborted (false), mMessages (nullptr), mRecords(0)
|
: mDocument (document), mTotalRecordsLabel (0), mRecordsLabel (0), mAborted (false), mMessages (nullptr), mRecords(0)
|
||||||
{
|
{
|
||||||
setWindowTitle (QString::fromStdWString(L"Opening " + document->getSavePath().filename().wstring()));
|
setWindowTitle (QString::fromStdU32String(U"Opening " + document->getSavePath().filename().u32string()));
|
||||||
|
|
||||||
setMinimumWidth (400);
|
setMinimumWidth (400);
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ bool CSVDoc::ViewManager::showModifiedDocumentMessageBox (CSVDoc::View *view)
|
||||||
QMessageBox messageBox(view);
|
QMessageBox messageBox(view);
|
||||||
CSMDoc::Document *document = view->getDocument();
|
CSMDoc::Document *document = view->getDocument();
|
||||||
|
|
||||||
messageBox.setWindowTitle (QString::fromStdWString(document->getSavePath().filename().wstring()));
|
messageBox.setWindowTitle (QString::fromStdU32String(document->getSavePath().filename().u32string()));
|
||||||
messageBox.setText ("The document has been modified.");
|
messageBox.setText ("The document has been modified.");
|
||||||
messageBox.setInformativeText ("Do you want to save your changes?");
|
messageBox.setInformativeText ("Do you want to save your changes?");
|
||||||
messageBox.setStandardButtons (QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
messageBox.setStandardButtons (QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
|
|
|
@ -102,7 +102,7 @@ void CSVTools::Merge::configure (CSMDoc::Document *document)
|
||||||
|
|
||||||
for (std::vector<std::filesystem::path>::const_iterator iter (files.begin());
|
for (std::vector<std::filesystem::path>::const_iterator iter (files.begin());
|
||||||
iter!=files.end(); ++iter)
|
iter!=files.end(); ++iter)
|
||||||
mFiles->addItem (QString::fromStdWString(iter->filename().wstring()));
|
mFiles->addItem (QString::fromStdU32String(iter->filename().u32string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVTools::Merge::setLocalData (const std::filesystem::path& localData)
|
void CSVTools::Merge::setLocalData (const std::filesystem::path& localData)
|
||||||
|
|
|
@ -440,7 +440,7 @@ namespace MWGui
|
||||||
const std::vector<char>& data = mCurrentSlot->mProfile.mScreenshot;
|
const std::vector<char>& data = mCurrentSlot->mProfile.mScreenshot;
|
||||||
if (!data.size())
|
if (!data.size())
|
||||||
{
|
{
|
||||||
Log(Debug::Warning) << "Selected save file '" << mCurrentSlot->mPath.filename().string() << "' has no savegame screenshot";
|
Log(Debug::Warning) << "Selected save file '" << Files::pathToUnicodeString(mCurrentSlot->mPath.filename()) << "' has no savegame screenshot";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -471,5 +471,5 @@ bool Wizard::MainWizard::findFiles(const QString &name, const QString &path)
|
||||||
|
|
||||||
QString Wizard::MainWizard::toQString(const std::filesystem::path& path)
|
QString Wizard::MainWizard::toQString(const std::filesystem::path& path)
|
||||||
{
|
{
|
||||||
return QString::fromStdWString(path.wstring());
|
return QString::fromStdU32String(path.u32string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <components/files/configurationmanager.hpp>
|
#include <components/files/configurationmanager.hpp>
|
||||||
|
|
||||||
|
@ -23,8 +24,7 @@ void Config::GameSettings::validatePaths()
|
||||||
|
|
||||||
for (const QString &path : paths)
|
for (const QString &path : paths)
|
||||||
{
|
{
|
||||||
QByteArray bytes = path.toUtf8();
|
dataDirs.emplace_back(path.toStdU32String());
|
||||||
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the data dirs to convert the tokenized paths
|
// Parse the data dirs to convert the tokenized paths
|
||||||
|
@ -32,7 +32,7 @@ void Config::GameSettings::validatePaths()
|
||||||
mDataDirs.clear();
|
mDataDirs.clear();
|
||||||
|
|
||||||
for (auto & dataDir : dataDirs) {
|
for (auto & dataDir : dataDirs) {
|
||||||
QString path = QString::fromStdWString(dataDir.wstring());
|
QString path = QString::fromStdU32String(dataDir.u32string());
|
||||||
|
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
|
@ -51,13 +51,12 @@ void Config::GameSettings::validatePaths()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dataDirs.clear();
|
dataDirs.clear();
|
||||||
QByteArray bytes = local.toUtf8();
|
dataDirs.emplace_back(local.toStdU32String());
|
||||||
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
|
|
||||||
|
|
||||||
mCfgMgr.processPaths(dataDirs, /*basePath=*/"");
|
mCfgMgr.processPaths(dataDirs, /*basePath=*/"");
|
||||||
|
|
||||||
if (!dataDirs.empty()) {
|
if (!dataDirs.empty()) {
|
||||||
QString path = QString::fromStdWString(dataDirs.front().wstring());
|
QString path = QString::fromStdU32String(dataDirs.front().u32string());
|
||||||
|
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
|
@ -68,8 +67,9 @@ void Config::GameSettings::validatePaths()
|
||||||
std::filesystem::path Config::GameSettings::getGlobalDataDir() const
|
std::filesystem::path Config::GameSettings::getGlobalDataDir() const
|
||||||
{
|
{
|
||||||
// global data dir may not exists if OpenMW is not installed (ie if run from build directory)
|
// global data dir may not exists if OpenMW is not installed (ie if run from build directory)
|
||||||
if (std::filesystem::exists(mCfgMgr.getGlobalDataPath()))
|
const auto& path = mCfgMgr.getGlobalDataPath();
|
||||||
return std::filesystem::canonical(mCfgMgr.getGlobalDataPath());
|
if (std::filesystem::exists(path))
|
||||||
|
return std::filesystem::canonical(path);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ void Config::LauncherSettings::setContentList(const GameSettings& gameSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// global and local data directories are not part of any profile
|
// global and local data directories are not part of any profile
|
||||||
const auto globalDataDir = QString::fromStdWString(gameSettings.getGlobalDataDir().wstring());
|
const auto globalDataDir = QString::fromStdU32String(gameSettings.getGlobalDataDir().u32string());
|
||||||
const auto dataLocal = gameSettings.getDataLocal();
|
const auto dataLocal = gameSettings.getDataLocal();
|
||||||
dirs.removeAll(globalDataDir);
|
dirs.removeAll(globalDataDir);
|
||||||
dirs.removeAll(dataLocal);
|
dirs.removeAll(dataLocal);
|
||||||
|
|
|
@ -99,7 +99,7 @@ void ConfigurationManager::readConfiguration(bpo::variables_map& variables,
|
||||||
|
|
||||||
while (!extraConfigDirs.empty())
|
while (!extraConfigDirs.empty())
|
||||||
{
|
{
|
||||||
std::filesystem::path path = extraConfigDirs.top();
|
auto path = extraConfigDirs.top();
|
||||||
extraConfigDirs.pop();
|
extraConfigDirs.pop();
|
||||||
if (alreadyParsedPaths.count(path) > 0)
|
if (alreadyParsedPaths.count(path) > 0)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ void ConfigurationManager::readConfiguration(bpo::variables_map& variables,
|
||||||
Log(Debug::Info) << "Skipping previous configs except " << (mActiveConfigPaths.front() / "openmw.cfg") <<
|
Log(Debug::Info) << "Skipping previous configs except " << (mActiveConfigPaths.front() / "openmw.cfg") <<
|
||||||
" due to replace=config in " << (path / "openmw.cfg");
|
" due to replace=config in " << (path / "openmw.cfg");
|
||||||
}
|
}
|
||||||
mActiveConfigPaths.push_back(path);
|
mActiveConfigPaths.emplace_back(std::move(path));
|
||||||
if (config)
|
if (config)
|
||||||
{
|
{
|
||||||
addExtraConfigDirs(extraConfigDirs, *config);
|
addExtraConfigDirs(extraConfigDirs, *config);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
#include <components/misc/strings/algorithm.hpp>
|
#include <components/misc/strings/algorithm.hpp>
|
||||||
|
#include <components/files/conversion.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
@ -324,6 +325,6 @@ bool Settings::SettingsFileParser::skipWhiteSpace(size_t& i, std::string& str)
|
||||||
[[noreturn]] void Settings::SettingsFileParser::fail(const std::string& message)
|
[[noreturn]] void Settings::SettingsFileParser::fail(const std::string& message)
|
||||||
{
|
{
|
||||||
std::stringstream error;
|
std::stringstream error;
|
||||||
error << "Error on line " << mLine << " in " << mFile << ":\n" << message;
|
error << "Error on line " << mLine << " in " << Files::pathToUnicodeString(mFile) << ":\n" << message;
|
||||||
throw std::runtime_error(error.str());
|
throw std::runtime_error(error.str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <components/misc/strings/algorithm.hpp>
|
#include <components/misc/strings/algorithm.hpp>
|
||||||
#include <components/misc/strings/format.hpp>
|
#include <components/misc/strings/format.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
#include <components/files/conversion.hpp>
|
||||||
|
|
||||||
namespace Shader
|
namespace Shader
|
||||||
{
|
{
|
||||||
|
@ -384,7 +385,7 @@ namespace Shader
|
||||||
const std::set<std::filesystem::path>& shaderFiles = templateIncludedFiles[templateName];
|
const std::set<std::filesystem::path>& shaderFiles = templateIncludedFiles[templateName];
|
||||||
for (const std::filesystem::path& file : shaderFiles)
|
for (const std::filesystem::path& file : shaderFiles)
|
||||||
{
|
{
|
||||||
mShaderFiles[file.string()].insert(std::make_pair(templateName, defines));
|
mShaderFiles[Files::pathToUnicodeString(file)].insert(std::make_pair(templateName, defines));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +427,7 @@ namespace Shader
|
||||||
stream.open(path);
|
stream.open(path);
|
||||||
if (stream.fail())
|
if (stream.fail())
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Failed to open " << path.string();
|
Log(Debug::Error) << "Failed to open " << Files::pathToUnicodeString(path);
|
||||||
}
|
}
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << stream.rdbuf();
|
buffer << stream.rdbuf();
|
||||||
|
|
Loading…
Reference in a new issue