OSDN Git Service

CueSheet Importer: Fixed generation of the initial (suggested) output folder name...
authorlordmulder <mulder2@gmx.de>
Tue, 29 May 2012 16:32:28 +0000 (18:32 +0200)
committerlordmulder <mulder2@gmx.de>
Tue, 29 May 2012 16:32:28 +0000 (18:32 +0200)
src/Config.h
src/Dialog_CueImport.cpp

index 37cd810..7d1e04f 100644 (file)
@@ -30,7 +30,7 @@
 #define VER_LAMEXP_MINOR_LO                                    5
 #define VER_LAMEXP_TYPE                                                Alpha
 #define VER_LAMEXP_PATCH                                       3
-#define VER_LAMEXP_BUILD                                       1031
+#define VER_LAMEXP_BUILD                                       1032
 
 ///////////////////////////////////////////////////////////////////////////////
 // Tool versions (minimum expected versions!)
index 6e8367d..eedf457 100644 (file)
@@ -175,10 +175,14 @@ int CueImportDialog::exec(void)
 
        //----------------------//
 
-       m_outputDir = QString("%1/%2").arg(cueFileInfo.canonicalPath(), cueFileInfo.completeBaseName());
+       QString baseName = cueFileInfo.completeBaseName().simplified();
+       while(m_outputDir.endsWith(".") || m_outputDir.endsWith(" ")) m_outputDir.chop(1);
+       if(m_outputDir.isEmpty()) baseName = "New Folder";
+
+       m_outputDir = QString("%1/%2").arg(cueFileInfo.canonicalPath(), baseName);
        for(int n = 2; QDir(m_outputDir).exists(); n++)
        {
-               m_outputDir = QString("%1/%2 (%3)").arg(cueFileInfo.canonicalPath(), cueFileInfo.completeBaseName(), QString::number(n));
+               m_outputDir = QString("%1/%2 (%3)").arg(cueFileInfo.canonicalPath(), baseName, QString::number(n));
        }
 
        setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName()));