mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:40:05 +00:00
Fix backslash interpretation in IconFile and Image statements
This commit is contained in:
parent
c5a56680ea
commit
8326b2f2bf
3 changed files with 12 additions and 6 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <execution>
|
||||
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <boost/unordered/unordered_flat_map.hpp>
|
||||
|
||||
|
|
@ -44,7 +45,8 @@ struct PlacefileIconInfo
|
|||
{
|
||||
// Resolve using base URL
|
||||
auto baseUrl = QUrl::fromUserInput(QString::fromStdString(baseUrlString));
|
||||
auto relativeUrl = QUrl(QString::fromStdString(iconFile->filename_));
|
||||
auto relativeUrl = QUrl(QDir::fromNativeSeparators(
|
||||
QString::fromStdString(iconFile->filename_)));
|
||||
resolvedUrl_ = baseUrl.resolved(relativeUrl).toString().toStdString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <scwx/qt/util/texture_atlas.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <boost/unordered/unordered_flat_map.hpp>
|
||||
|
||||
|
|
@ -39,7 +40,8 @@ struct PlacefileImageInfo
|
|||
{
|
||||
// Resolve using base URL
|
||||
auto baseUrl = QUrl::fromUserInput(QString::fromStdString(baseUrlString));
|
||||
auto relativeUrl = QUrl(QString::fromStdString(imageFile));
|
||||
auto relativeUrl =
|
||||
QUrl(QDir::fromNativeSeparators(QString::fromStdString(imageFile)));
|
||||
resolvedUrl_ = baseUrl.resolved(relativeUrl).toString().toStdString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -765,8 +765,9 @@ PlacefileManager::Impl::LoadImageResources(
|
|||
[&baseUrl](auto& iconFile)
|
||||
{
|
||||
// Resolve target URL relative to base URL
|
||||
QUrl fileUrl =
|
||||
QUrl(QString::fromStdString(iconFile->filename_));
|
||||
QString filePath =
|
||||
QString::fromStdString(iconFile->filename_);
|
||||
QUrl fileUrl = QUrl(QDir::fromNativeSeparators(filePath));
|
||||
QUrl resolvedUrl = baseUrl.resolved(fileUrl);
|
||||
|
||||
return resolvedUrl.toString().toStdString();
|
||||
|
|
@ -783,7 +784,8 @@ PlacefileManager::Impl::LoadImageResources(
|
|||
std::static_pointer_cast<gr::Placefile::ImageDrawItem>(di)
|
||||
->imageFile_;
|
||||
|
||||
QUrl fileUrl = QUrl(QString::fromStdString(imageFile));
|
||||
QString filePath = QString::fromStdString(imageFile);
|
||||
QUrl fileUrl = QUrl(QDir::fromNativeSeparators(filePath));
|
||||
QUrl resolvedUrl = baseUrl.resolved(fileUrl);
|
||||
std::string urlString = resolvedUrl.toString().toStdString();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue