diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-10-09 14:00:11 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2011-10-09 14:00:11 +0000 |
| commit | 831419a680bc3d4ca28f53eb11d14964d5f23cea (patch) | |
| tree | 02943c43ff0edb9cfb5ed2f4191d99c7d6ffc5cc /src/plugins/General/converter/converter.cpp | |
| parent | 1aa529d828d742ab51c0b106723acca15edfffce (diff) | |
| download | qmmp-831419a680bc3d4ca28f53eb11d14964d5f23cea.tar.gz qmmp-831419a680bc3d4ca28f53eb11d14964d5f23cea.tar.bz2 qmmp-831419a680bc3d4ca28f53eb11d14964d5f23cea.zip | |
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
Diffstat (limited to 'src/plugins/General/converter/converter.cpp')
| -rw-r--r-- | src/plugins/General/converter/converter.cpp | 16 |
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 + "\""); |
