[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktexteditor] src/swapfile: Fix broken swap-file on windows
From:       Kåre Särs <kare.sars () iki ! fi>
Date:       2016-08-25 9:39:38
Message-ID: E1bcr8M-0004fk-SJ () code ! kde ! org
[Download RAW message or body]

Git commit bdb140d871a3b6af8767d7d4286c78ba6bbaa201 by Kåre Särs.
Committed on 25/08/2016 at 09:28.
Pushed by sars into branch 'master'.

Fix broken swap-file on windows

Also fix alternative-directory swap-files on all platforms.

The swap-file problem was QDir::separator() usage in stead of '/'.
QUrl always uses '/' regardless of platform.

The alternative-directory swap-files was trying to use the
raw hash of the document unconverted to hex.

There is still one QDir::separator() usage in:
src/document/katedocument.cpp that should be checked!

CCMAIL: kwrite-devel@kde.org

M  +3    -3    src/swapfile/kateswapfile.cpp

http://commits.kde.org/ktexteditor/bdb140d871a3b6af8767d7d4286c78ba6bbaa201

diff --git a/src/swapfile/kateswapfile.cpp b/src/swapfile/kateswapfile.cpp
index 0dbc731..2b52978 100644
--- a/src/swapfile/kateswapfile.cpp
+++ b/src/swapfile/kateswapfile.cpp
@@ -585,12 +585,12 @@ QString SwapFile::fileName()
 
     if (KateDocumentConfig::global()->swapFileMode() == KateDocumentConfig::SwapFilePresetDirectory) {
         path = KateDocumentConfig::global()->swapDirectory();
-        path.append(QDir::separator());
-        path.append(QString::fromLatin1(m_document->checksum()));
+        path.append(QLatin1Char('/'));
+        path.append(QString::fromLatin1(m_document->checksum().toHex()));
         path.append(QLatin1String(".kate-swp"));
     } else {
         path = url.toLocalFile();
-        int poz = path.lastIndexOf(QDir::separator());
+        int poz = path.lastIndexOf(QLatin1Char('/'));
         path.insert(poz + 1, QLatin1String("."));
         path.append(QLatin1String(".kate-swp"));
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic