aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Potashev <[email protected]>2015-07-09 05:47:16 +0300
committerAlexander Potashev <[email protected]>2015-07-09 05:50:05 +0300
commit476892966d90fca981fbc38dbcd555ef3bb5a59c (patch)
tree520cd2a73a1df979fa9760960fa96c2a7e811f81
parent4ae4613a902b5be037cdfc8a7402b6cd99828519 (diff)
Fix automatic generation of scripts.rcv15.08.0v15.07.90v15.07.80
Lokalize 15.04.x was creating a directory "scripts.rc" and thus it could not write or load scripting configuration. Regression introduced in commit: commit e203395611a6d2f5644682b541144ab28c8b9c61 Author: Nick Shaforostoff <[email protected]> Date: Tue Dec 2 01:31:45 2014 +0000 first increment of getting rid of kurl CCMAIL: [email protected]
-rw-r--r--src/lokalizemainwindow.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lokalizemainwindow.cpp b/src/lokalizemainwindow.cpp
index ba56f2b..7f5ddae 100644
--- a/src/lokalizemainwindow.cpp
+++ b/src/lokalizemainwindow.cpp
@@ -796,9 +796,20 @@ ProjectScriptingPlugin::ProjectScriptingPlugin(QObject* lokalize, QObject* edito
return;
QString filepath=PROJECTRCFILEPATH;
+
+ // Remove directory "scripts.rc" if it is empty. It could be
+ // mistakenly created by Lokalize 15.04.x.
+ if (QFileInfo(filepath).isDir() && !QDir().rmdir(filepath))
+ {
+ qCritical() << "Failed to remove directory" << filepath <<
+ "to create scripting configuration file with at the same path. " <<
+ "The directory may be not empty.";
+ return;
+ }
+
if (!QFile::exists(filepath))
{
- QDir(QFileInfo(QFileInfo(filepath).filePath()).filePath()).mkdir(QFileInfo(filepath).filePath());
+ QDir().mkdir(QFileInfo(filepath).dir().path());
QFile f(filepath);
if (!f.open(QIODevice::WriteOnly))
return;