Fix loading relative file path samples

Closes #2412
This commit is contained in:
Lukas W
2016-02-11 11:58:42 +13:00
parent 1290e33207
commit ca8f80d44f
3 changed files with 15 additions and 11 deletions

View File

@@ -201,7 +201,7 @@ public:
QString fullName() const
{
return QFileInfo(m_path, text(0)).absoluteFilePath();
return QDir::cleanPath(m_path) + "/" + text(0);
}
inline FileTypes type( void ) const

View File

@@ -253,7 +253,7 @@ public:
}
static QString tryToMakeRelative( const QString & _file );
static QString tryToMakeAbsolute( const QString & _file );
static QString tryToMakeAbsolute(const QString & file);
public slots:

View File

@@ -1414,20 +1414,24 @@ QString SampleBuffer::tryToMakeRelative( const QString & _file )
QString SampleBuffer::tryToMakeAbsolute( const QString & _file )
QString SampleBuffer::tryToMakeAbsolute(const QString& file)
{
if( QFileInfo( _file ).isAbsolute() )
QFileInfo f(file);
if(f.isRelative())
{
return _file;
f = QFileInfo(ConfigManager::inst()->userSamplesDir() + file);
if(! f.exists())
{
f = QFileInfo(ConfigManager::inst()->factorySamplesDir() + file);
}
}
QString f = ConfigManager::inst()->userSamplesDir() + _file;
if( QFileInfo( f ).exists() )
{
return f;
if (f.exists()) {
return f.absoluteFilePath();
}
return ConfigManager::inst()->factorySamplesDir() + _file;
return file;
}