Allow relative paths on non-existent directories (#4271)
* Use cleanPath for calculating relative directories Closes #4267
This commit is contained in:
@@ -227,7 +227,7 @@ bool ConfigManager::hasWorkingDir() const
|
||||
|
||||
void ConfigManager::setWorkingDir( const QString & wd )
|
||||
{
|
||||
m_workingDir = ensureTrailingSlash( QFileInfo( wd ).canonicalFilePath() );
|
||||
m_workingDir = ensureTrailingSlash( QDir::cleanPath( wd ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1416,7 +1416,7 @@ QString SampleBuffer::tryToMakeRelative( const QString & file )
|
||||
if( QFileInfo( file ).isRelative() == false )
|
||||
{
|
||||
// Normalize the path
|
||||
QString f = QFileInfo( file ).canonicalFilePath().replace( QDir::separator(), '/' );
|
||||
QString f( QDir::cleanPath( file ) );
|
||||
|
||||
// First, look in factory samples
|
||||
// Isolate "samples/" from "data:/samples/"
|
||||
@@ -1425,7 +1425,7 @@ QString SampleBuffer::tryToMakeRelative( const QString & file )
|
||||
// Iterate over all valid "data:/" searchPaths
|
||||
for ( const QString & path : QDir::searchPaths( "data" ) )
|
||||
{
|
||||
QString samplesPath = QString( path + samplesSuffix ).replace( QDir::separator(), '/' );
|
||||
QString samplesPath = QDir::cleanPath( path + samplesSuffix ) + "/";
|
||||
if ( f.startsWith( samplesPath ) )
|
||||
{
|
||||
return QString( f ).mid( samplesPath.length() );
|
||||
|
||||
Reference in New Issue
Block a user