Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ bool ConfigManager::hasWorkingDir() const
}


void ConfigManager::setWorkingDir( const QString & _wd )
void ConfigManager::setWorkingDir( const QString & wd )
{
m_workingDir = ensureTrailingSlash( _wd );
m_workingDir = ensureTrailingSlash( QFileInfo( wd ).canonicalFilePath() );
}


Expand Down
3 changes: 2 additions & 1 deletion src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,8 @@ QString SampleBuffer::tryToMakeRelative( const QString & file )
{
if( QFileInfo( file ).isRelative() == false )
{
QString f = QString( file ).replace( QDir::separator(), '/' );
// Normalize the path
QString f = QFileInfo( file ).canonicalFilePath().replace( QDir::separator(), '/' );

// First, look in factory samples
// Isolate "samples/" from "data:/samples/"
Expand Down
2 changes: 2 additions & 0 deletions tests/src/core/RelativePathsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ private slots:

QString absPath = fi.absoluteFilePath();
QString relPath = "drums/kick01.ogg";
QString fuzPath = absPath.replace(relPath, "drums/.///kick01.ogg");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current one won't work because this line modifies absPath. This one will work:

QString fuzPath = absPath;
fuzPath.replace(relPath, "drums/.///kick01.ogg");

Copy link
Member Author

@tresf tresf Mar 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, forgot Strings are mutable in Qt. Thanks.

QCOMPARE(SampleBuffer::tryToMakeRelative(absPath), relPath);
QCOMPARE(SampleBuffer::tryToMakeAbsolute(relPath), absPath);
QCOMPARE(SampleBuffer::tryToMakeRelative(fuzPath), relPath);
}
} RelativePathTests;

Expand Down