Use QUrl::fromUserInput() to handle local file paths (without "file://") as well.
QUrl::AssumeLocalFile is passed to avoid DNS lookups for non-existent/mistyped file names.
Details
- Reviewers
fvogt - Group Reviewers
Amarok - Commits
- R181:cea336303aaf: Fix passing local file paths on the command line
Created a file 1d5d9dD.oga in /home/wolfi/Desktop/ (anything will do of course).
Ran:
- amarok file:///home/wolfi/Desktop/1d5d9dD.oga
- amarok /home/wolfi/Desktop/1d5d9dD.oga
- cd /home/wolfi/Desktop ; amarok 1d5d9dD.oga
The file was opened and played sucessfully in all cases, whereas before only the first one worked (with phonon-backend-gstreamer at least).
Tested with both phonon-backend-gstreamer and phonon-backend-vlc.
Diff Detail
- Repository
- R181 Amarok
- Lint
Lint Skipped - Unit
Unit Tests Skipped
src/App.cpp | ||
---|---|---|
280 | Did it previously also handle relative paths such as ./foo.ogg? If so, passing QDir::currentPath() instead of a null string is AFAICT necessary. |
src/App.cpp | ||
---|---|---|
280 | It does handle relative paths just fine, see the test plan. (I just tried ./foo.ogg to be sure) I just noticed that amarok has a "--cwd" command line option though (that is currently ignored AFAICS), it would probably be good to pass that instead. |
src/App.cpp | ||
---|---|---|
280 |
Hm, the "--cwd" option is not even parsed correctly (the QCommandLineOption doesn't specify that it actually takes an argument, therefore it's always empty if set). So I'll leave this patch as-is. |