Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 37503482 authored by Boudewijn Rempt's avatar Boudewijn Rempt

BUG:345217 Fix loading some pre 2.9 .kra files

If a part of a path started with a number, KoStore pre 2.9 would prepend
'part'. We don't do that anymore, but there are files out there with that
weirdness, so check whether the path can be opened, and if it can't,
fix it up.
parent c9384071
......@@ -55,10 +55,27 @@
#include "kis_shape_selection.h"
#include "kis_dom_utils.h"
using namespace KRA;
QString expandEncodedDirectory(const QString& _intern)
{
QString intern = _intern;
QString result;
int pos;
while ((pos = intern.indexOf('/')) != -1) {
if (QChar(intern.at(0)).isDigit())
result += "part";
result += intern.left(pos + 1); // copy numbers (or "pictures") + "/"
intern = intern.mid(pos + 1); // remove the dir we just processed
}
if (!intern.isEmpty() && QChar(intern.at(0)).isDigit())
result += "part";
result += intern;
return result;
}
using namespace KRA;
KisKraLoadVisitor::KisKraLoadVisitor(KisImageWSP image,
KoStore *store,
......@@ -72,6 +89,14 @@ KisKraLoadVisitor::KisKraLoadVisitor(KisImageWSP image,
m_image = image;
m_store = store;
m_name = name;
m_store->pushDirectory();
if (!m_store->enterDirectory(m_name)) {
dbgFile << "Could not enter directory" << m_name << ", probably an old-style file with 'part' added.";
m_name = expandEncodedDirectory(m_name);
}
else {
m_store->popDirectory();
}
m_syntaxVersion = syntaxVersion;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment