summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-06-30 01:27:44 +0200
committerPetr Mrázek <peterix@gmail.com>2018-06-30 01:27:44 +0200
commit8516a6646e9dc57b909dbbe98e6e1b73180acc2f (patch)
tree4b2683577fffdb91d0a66003c1340206aeeb0fc0 /application/pages
parent44381c09d79ca24ac7ea993c43cc2f52a6e151fe (diff)
downloadMultiMC-8516a6646e9dc57b909dbbe98e6e1b73180acc2f.tar
MultiMC-8516a6646e9dc57b909dbbe98e6e1b73180acc2f.tar.gz
MultiMC-8516a6646e9dc57b909dbbe98e6e1b73180acc2f.tar.lz
MultiMC-8516a6646e9dc57b909dbbe98e6e1b73180acc2f.tar.xz
MultiMC-8516a6646e9dc57b909dbbe98e6e1b73180acc2f.zip
NOISSUE fix saving the servers.dat file when it doesn't exist yet
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/instance/ServersPage.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/application/pages/instance/ServersPage.cpp b/application/pages/instance/ServersPage.cpp
index 1612ce09..4788e8b0 100644
--- a/application/pages/instance/ServersPage.cpp
+++ b/application/pages/instance/ServersPage.cpp
@@ -119,6 +119,10 @@ static bool serializeServerDat(const QString& filename, nbt::tag_compound * leve
{
try
{
+ if(!FS::ensureFilePathExists(filename))
+ {
+ return false;
+ }
std::ostringstream s;
nbt::io::write_tag("", *levelInfo, s);
QByteArray val(s.str().data(), (int) s.str().size() );
@@ -460,7 +464,8 @@ private slots:
void save_internal()
{
cancelSave();
- qDebug() << "Server list save is performed for" << m_path;
+ QString path = serversPath();
+ qDebug() << "Server list about to be saved to" << path;
nbt::tag_compound out;
nbt::tag_list list;
@@ -472,9 +477,9 @@ private slots:
}
out.insert("servers", nbt::value(std::move(list)));
- if(!serializeServerDat(serversPath(), &out))
+ if(!serializeServerDat(path, &out))
{
- qDebug() << "Failed to save server list:" << m_path << "Will try again.";
+ qDebug() << "Failed to save server list:" << path << "Will try again.";
scheduleSave();
}
}
@@ -536,7 +541,7 @@ private:
QString serversPath()
{
QFileInfo foo(FS::PathCombine(m_path, "servers.dat"));
- return foo.canonicalFilePath();
+ return foo.filePath();
}
private: