From 831419a680bc3d4ca28f53eb11d14964d5f23cea Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 9 Oct 2011 14:00:11 +0000 Subject: converter: enabled "overwrite existing file" option git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2388 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/converter/converter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/plugins/General/converter/converter.cpp') 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 + "\""); -- cgit v1.2.3-13-gbd6f