#define VER_LAMEXP_MINOR_HI 1
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Beta
-#define VER_LAMEXP_PATCH 6
-#define VER_LAMEXP_BUILD 1801
+#define VER_LAMEXP_PATCH 7
+#define VER_LAMEXP_BUILD 1803
#define VER_LAMEXP_CONFG 1700
///////////////////////////////////////////////////////////////////////////////
static void lamexp_tools_clean_up(void)
{
QWriteLocker writeLock(&g_lamexp_tools_lock);
+ qWarning("------------ lamexp_tools_clean_up ------------");
if(!g_lamexp_tools_data.isNull())
{
}
}
+static __forceinline bool doRemoveFile(const QString &filePath)
+{
+ for(int i = 0; i < 32; i++)
+ {
+ if(MUtils::remove_file(filePath))
+ {
+ return true;
+ }
+ MUtils::OS::sleep_ms(1);
+ }
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////
LockedFile::LockedFile(QResource *const resource, const QString &outPath, const QByteArray &expectedHash, const bool bOwnsFile)
LockedFile::~LockedFile(void)
{
+ qWarning("------------ LockedFile::~LockedFile ------------");
+
if(m_fileDescriptor >= 0)
{
_close(m_fileDescriptor);
}
if(m_bOwnsFile)
{
- if(QFileInfo(m_filePath).exists())
- {
- for(int i = 0; i < 64; i++)
- {
- if(QFile::remove(m_filePath)) break;
- MUtils::OS::sleep_ms(1);
- }
- }
+ doRemoveFile(m_filePath);
}
}
ExtractorTask(QResource *const toolResource, const QDir &appDir, const QString &toolName, const QByteArray &toolHash, const unsigned int toolVersion, const QString &toolTag)
:
m_appDir(appDir),
+ m_tempPath(MUtils::temp_folder()),
m_toolName(toolName),
m_toolHash(toolHash),
m_toolVersion(toolVersion),
if(lockedFile.isNull())
{
qDebug("Extracting file: %s -> %s", m_toolName.toLatin1().constData(), toolShrtName.toLatin1().constData());
- lockedFile.reset(new LockedFile(m_toolResource.data(), QString("%1/lxp_%2").arg(MUtils::temp_folder(), toolShrtName), m_toolHash));
+ lockedFile.reset(new LockedFile(m_toolResource.data(), QString("%1/lxp_%2").arg(m_tempPath, toolShrtName), m_toolHash));
}
//Register tool
}
private:
+ static volatile bool s_bCustom;
QScopedPointer<QResource> m_toolResource;
- const QDir m_appDir;
- const QString m_toolName;
- const QByteArray m_toolHash;
- const unsigned int m_toolVersion;
- const QString m_toolTag;
-
- static volatile bool s_bCustom;
+ const QDir m_appDir;
+ const QString m_tempPath;
+ const QString m_toolName;
+ const QByteArray m_toolHash;
+ const unsigned int m_toolVersion;
+ const QString m_toolTag;
};
volatile bool ExtractorTask::s_bCustom = false;
QString ProcessThread::generateTempFileName(void)
{
- bool bOkay = false;
- QString tempFileName;
-
- for(int i = 0; i < 4096; i++)
- {
- tempFileName = QString("%1/%2.wav").arg(m_tempDirectory, MUtils::rand_str());
- if(m_tempFiles.contains(tempFileName, Qt::CaseInsensitive) || QFileInfo(tempFileName).exists())
- {
- continue;
- }
-
- QFile file(tempFileName);
- if(file.open(QFile::ReadWrite))
- {
- file.close();
- bOkay = true;
- break;
- }
- }
-
- if(!bOkay)
+ const QString tempFileName = MUtils::make_temp_file(m_tempDirectory, "wav", true);
+ if(tempFileName.isEmpty())
{
- qWarning("Failed to generate unique temp file name!");
- return QString("%1/~whoops.wav").arg(m_tempDirectory);
+ return QString("%1/~whoops%2.wav").arg(m_tempDirectory, QString::number(MUtils::next_rand32()));
}
m_tempFiles << tempFileName;