Commit b9ccef89 authored by Inge Wallin's avatar Inge Wallin

Fix bug 305794: Uncompressed ODF is saved in wrong directory

This fix does that the old code tried to do but failed: Check if the
given path is a directory. But it does so using QDir so it's actually
portable.

BUG: 305794
FIXED-IN: 2.5.1
REVIEW: 106200
parent ecfd82bb
...@@ -30,13 +30,18 @@ KoDirectoryStore::KoDirectoryStore(const QString& path, Mode _mode) ...@@ -30,13 +30,18 @@ KoDirectoryStore::KoDirectoryStore(const QString& path, Mode _mode)
: m_basePath(path) : m_basePath(path)
{ {
Q_D(KoStore); Q_D(KoStore);
const int pos = path.lastIndexOf('/'); //kDebug(30002) << "path:" << path;
if (pos != -1 && pos != m_basePath.length() - 1)
m_basePath = m_basePath.left(pos); QDir dir(path);
if (!dir.exists())
dir.cdUp();
m_basePath = QDir::cleanPath(dir.path());
if (!m_basePath.endsWith('/')) if (!m_basePath.endsWith('/'))
m_basePath += '/'; m_basePath += '/';
m_currentPath = m_basePath; m_currentPath = m_basePath;
kDebug(30002) << "KoDirectoryStore::KoDirectoryStore base path:" << m_basePath; //kDebug(30002) << "base path:" << m_basePath;
d->good = init(_mode); d->good = init(_mode);
} }
......
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