Skip to content

Commit

Permalink
Merge pull request #2659 from Holzhaus/serato-library-feature-path-fix
Browse files Browse the repository at this point in the history
library/serato/seratofeature: Fix relative paths on OSX (and on Linux)
  • Loading branch information
Be-ing authored Apr 16, 2020
2 parents d72575d + b26c276 commit 36276a3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/library/serato/seratofeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,25 @@ QString parseDatabase(mixxx::DbConnectionPoolPtr dbConnectionPool, TreeItem* dat
databaseRootDir.cdUp();

#if defined(__WINDOWS__)
// Find drive letter (paths are relative to drive root on Windows)
// On Windows, all paths are relative to drive root of the database (e.g.
// "C:\"). Qt doesn't seem to provide a way to find it for a specific path,
// so we just call cdUp() until it stops working.
while (databaseRootDir.cdUp()) {
// Nothing to do here
}
#else
// If the file is on an external drive, the database path are relative to
// its mountpoint, i.e. the parent directory of the _Serato_
// directory. This means we can just use the path as-is.
//
// If the file is not on an external drive, the paths are all relative to
// the file system's root directory ("/").
//
// Serato does not exist on Linux, if it did, it would probably just mirror
// the way paths are handled on OSX.
if (databaseRootDir.canonicalPath().startsWith(QDir::homePath())) {
databaseRootDir = QDir::root();
}
#endif

qDebug() << "Parsing Serato database"
Expand Down

0 comments on commit 36276a3

Please sign in to comment.