Commit a83b6065 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

Fix for the CD not being recognised if it is not in the first drive

In KCompactDisc::cdromDeviceUrl(), if the device name is not in the
description-to-URL map it is assumed to be a device name in the form
"/dev/srN" and is converted to 'passedUrl' for checking against the same
map.  Unfortunately in Qt5 QUrl("/dev/srN") does not return a full URL
including the "file" scheme, so it will not compare equal to any
of the map URLs.  The effect is that defaultCdromDeviceUrl() is used,
which is taken to be the first map entry.  Therefore, if the disc is not
in the first drive, an incorrect device URL will be used and the disc
reading fails.

Use QUrl::fromLocalFile() to generate a correct URL for the device name.

Allow WMlib debugging to be enabled without recompiling KCompactDisc,
by setting the environment variable KCOMPACTDISC_WMLIB_DEBUG.
parent 5c693f16
......@@ -166,7 +166,7 @@ const QUrl KCompactDisc::cdromDeviceUrl(const QString &cdromDeviceName)
QUrl result = nameUrls.value(cdromDeviceName);
if (!result.isValid())
{
const QUrl passedUrl(cdromDeviceName);
const QUrl passedUrl = QUrl::fromLocalFile(cdromDeviceName);
foreach(const QUrl &url, nameUrls)
{
if (url == passedUrl)
......
......@@ -54,12 +54,12 @@ KWMLibCompactDiscPrivate::~KWMLibCompactDiscPrivate()
bool KWMLibCompactDiscPrivate::createInterface()
{
QString devicePath;
devicePath = KCompactDisc::cdromDeviceUrl(m_deviceName).path();
const QString devicePath = KCompactDisc::cdromDeviceUrl(m_deviceName).path();
// Debug.
//wm_cd_set_verbosity(WM_MSG_LEVEL_DEBUG | WM_MSG_CLASS_ALL);
if (qEnvironmentVariableIsSet("KCOMPACTDISC_WMLIB_DEBUG")) {
wm_cd_set_verbosity(WM_MSG_LEVEL_DEBUG | WM_MSG_CLASS_ALL);
}
int status = wm_cd_init(
devicePath.toLatin1().data(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment