aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/converter/converter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General/converter/converter.cpp')
-rw-r--r--src/plugins/General/converter/converter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/General/converter/converter.cpp b/src/plugins/General/converter/converter.cpp
index 6ecb6667c..5296b2fdf 100644
--- a/src/plugins/General/converter/converter.cpp
+++ b/src/plugins/General/converter/converter.cpp
@@ -149,6 +149,22 @@ void Converter::run()
QString name = formatter.parse(list[0]->metaData(), list[0]->length());
QString full_path = out_path + "/" + name + "." + preset["ext"].toString();
+
+ if(QFile::exists(full_path))
+ {
+ if(preset["overwrite"].toBool()) //remove previous file
+ QFile::remove(full_path);
+ else
+ {
+ int i = 0;
+ while(QFile::exists(full_path)) //create file with another name
+ {
+ ++i;
+ full_path = out_path + "/" + name + QString("_%1.").arg(i) + preset["ext"].toString();
+ }
+ }
+ }
+
QString command = preset["command"].toString();
command.replace("%o", "\"" + full_path + "\"");