Compare commits

...

6 Commits

12 changed files with 37 additions and 36 deletions

View File

@ -308,7 +308,7 @@ bool CommandlineOptions::Parse() {
QString value = QFile::decodeName(argv_[i]); QString value = QFile::decodeName(argv_[i]);
QFileInfo file_info(value); QFileInfo file_info(value);
if (file_info.exists()) if (file_info.exists())
urls_ << QUrl::fromLocalFile(file_info.canonicalFilePath()); urls_ << QUrl::fromLocalFile(file_info.absoluteFilePath());
else else
urls_ << QUrl::fromUserInput(value); urls_ << QUrl::fromUserInput(value);
} }

View File

@ -725,8 +725,11 @@ bool UrlOnSameDriveAsClementine(const QUrl& url) {
if (url.scheme() != "file") return false; if (url.scheme() != "file") return false;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QUrl canUrl =
QUrl::fromLocalFile(QFileInfo(url.toLocalFile()).canonicalFilePath());
QUrl appUrl = QUrl::fromLocalFile(QCoreApplication::applicationDirPath()); QUrl appUrl = QUrl::fromLocalFile(QCoreApplication::applicationDirPath());
if (url.toLocalFile().left(1) == appUrl.toLocalFile().left(1))
if (canUrl.toLocalFile().left(1) == appUrl.toLocalFile().left(1))
return true; return true;
else else
return false; return false;

View File

@ -218,11 +218,11 @@ void LibraryBackend::UpdateTotalSongCount() {
} }
void LibraryBackend::AddDirectory(const QString& path) { void LibraryBackend::AddDirectory(const QString& path) {
QString canonical_path = QFileInfo(path).canonicalFilePath(); QString absolute_path = QFileInfo(path).absoluteFilePath();
QString db_path = canonical_path; QString db_path = absolute_path;
if (Application::kIsPortable && Utilities::UrlOnSameDriveAsClementine( if (Application::kIsPortable && Utilities::UrlOnSameDriveAsClementine(
QUrl::fromLocalFile(canonical_path))) { QUrl::fromLocalFile(absolute_path))) {
db_path = Utilities::GetRelativePathToClementineBin(db_path); db_path = Utilities::GetRelativePathToClementineBin(db_path);
qLog(Debug) << "db_path" << db_path; qLog(Debug) << "db_path" << db_path;
} }
@ -239,7 +239,7 @@ void LibraryBackend::AddDirectory(const QString& path) {
if (db_->CheckErrors(q)) return; if (db_->CheckErrors(q)) return;
Directory dir; Directory dir;
dir.path = canonical_path; dir.path = absolute_path;
dir.id = q.lastInsertId().toInt(); dir.id = q.lastInsertId().toInt();
emit DirectoryDiscovered(dir, SubdirectoryList()); emit DirectoryDiscovered(dir, SubdirectoryList());

View File

@ -467,7 +467,7 @@ void IncomingDataParser::AppendFilesToPlaylist(
QDir dir(fi_folder.absoluteFilePath()); QDir dir(fi_folder.absoluteFilePath());
for (const auto& file : req_append.files()) { for (const auto& file : req_append.files()) {
QFileInfo fi(dir, file.c_str()); QFileInfo fi(dir, file.c_str());
if (fi.exists()) urls << QUrl::fromLocalFile(fi.canonicalFilePath()); if (fi.exists()) urls << QUrl::fromLocalFile(fi.absoluteFilePath());
} }
if (!urls.isEmpty()) { if (!urls.isEmpty()) {
MimeData* data = new MimeData; MimeData* data = new MimeData;

View File

@ -53,15 +53,12 @@ void ParserBase::LoadSong(const QString& filename_or_url, qint64 beginning,
// was created on/for, using replace() lets playlists work on any platform. // was created on/for, using replace() lets playlists work on any platform.
filename = filename.replace('\\', '/'); filename = filename.replace('\\', '/');
// Make the path absolute // Make the path absolute and clean it
if (!QDir::isAbsolutePath(filename)) { if (!QDir::isAbsolutePath(filename)) {
filename = dir.absoluteFilePath(filename); filename = dir.absoluteFilePath(filename);
} }
// Use the canonical path filename = QDir::cleanPath(filename);
if (QFile::exists(filename)) {
filename = QFileInfo(filename).canonicalFilePath();
}
const QUrl url = QUrl::fromLocalFile(filename); const QUrl url = QUrl::fromLocalFile(filename);

View File

@ -61,7 +61,7 @@ class ParserBase : public QObject {
protected: protected:
// Loads a song. If filename_or_url is a URL (with a scheme other than // Loads a song. If filename_or_url is a URL (with a scheme other than
// "file") then it is set on the song and the song marked as a stream. // "file") then it is set on the song and the song marked as a stream.
// If it is a filename or a file:// URL then it is made absolute and canonical // If it is a filename or a file:// URL then it is made absolute and cleaned
// and set as a file:// url on the song. Also sets the song's metadata by // and set as a file:// url on the song. Also sets the song's metadata by
// searching in the Library, or loading from the file as a fallback. // searching in the Library, or loading from the file as a fallback.
// This function should always be used when loading a playlist. // This function should always be used when loading a playlist.

View File

@ -42,6 +42,7 @@
# Martin Brodbeck <martin@brodbeck-online.de>, 2013 # Martin Brodbeck <martin@brodbeck-online.de>, 2013
# Martin Herkt <lachs0r@hong-mailing.de>, 2011 # Martin Herkt <lachs0r@hong-mailing.de>, 2011
# Martin Herkt <luck3r@phicode.de>, 2010 # Martin Herkt <luck3r@phicode.de>, 2010
# Michael Kohler, 2024
# MCMicS, 2020 # MCMicS, 2020
# Mohamed Sakhri, 2013 # Mohamed Sakhri, 2013
# Mohamed Sakhri, 2013 # Mohamed Sakhri, 2013
@ -70,7 +71,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-04-09 10:24+0000\n" "POT-Creation-Date: 2011-04-09 10:24+0000\n"
"PO-Revision-Date: 2011-10-27 18:53+0000\n" "PO-Revision-Date: 2011-10-27 18:53+0000\n"
"Last-Translator: 6543 <6543@obermui.de>, 2020\n" "Last-Translator: Michael Kohler, 2024\n"
"Language-Team: German (http://app.transifex.com/davidsansome/clementine/language/de/)\n" "Language-Team: German (http://app.transifex.com/davidsansome/clementine/language/de/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -219,7 +220,7 @@ msgid "1 track"
msgstr "1 Titel" msgstr "1 Titel"
msgid "128K MP3" msgid "128K MP3"
msgstr "" msgstr "128K MP3"
msgid "128k MP3" msgid "128k MP3"
msgstr "128k MP3" msgstr "128k MP3"
@ -240,7 +241,7 @@ msgid "A Grooveshark Anywhere account is required."
msgstr "" msgstr ""
msgid "A Spotify Premium account is required." msgid "A Spotify Premium account is required."
msgstr "" msgstr "Spotify Premium Zugang wird benötigt."
msgid "" msgid ""
"A smart playlist is a dynamic list of songs that come from your library. " "A smart playlist is a dynamic list of songs that come from your library. "
@ -293,7 +294,7 @@ msgid "Action"
msgstr "Aktion" msgstr "Aktion"
msgid "Active/deactive Wiiremote" msgid "Active/deactive Wiiremote"
msgstr "" msgstr "Aktivieren/deaktivieren Wiiremote"
msgid "Add Stream" msgid "Add Stream"
msgstr "Datenstrom hinzufügen" msgstr "Datenstrom hinzufügen"
@ -326,7 +327,7 @@ msgid "Add folder..."
msgstr "Ordner hinzufügen …" msgstr "Ordner hinzufügen …"
msgid "Add media" msgid "Add media"
msgstr "" msgstr "Medien hinzufügen ..."
msgid "Add new folder..." msgid "Add new folder..."
msgstr "Neuen Ordner hinzufügen …" msgstr "Neuen Ordner hinzufügen …"
@ -386,7 +387,7 @@ msgid "Add wiimotedev action"
msgstr "Aktion für Wii-Fernbedienung hinzufügen" msgstr "Aktion für Wii-Fernbedienung hinzufügen"
msgid "Add..." msgid "Add..."
msgstr "" msgstr "Hinzufügen …"
msgid "Added this month" msgid "Added this month"
msgstr "Diesen Monat hinzugefügt" msgstr "Diesen Monat hinzugefügt"
@ -422,7 +423,7 @@ msgid "Album info on jamendo.com..."
msgstr "Albuminformationen auf jamendo.com …" msgstr "Albuminformationen auf jamendo.com …"
msgid "Albumartist" msgid "Albumartist"
msgstr "" msgstr "Albumkünstler"
msgid "Albums with covers" msgid "Albums with covers"
msgstr "Alben mit Titelbildern" msgstr "Alben mit Titelbildern"
@ -633,7 +634,7 @@ msgid "CUE sheet support"
msgstr "Unterstützung von Cuesheets" msgstr "Unterstützung von Cuesheets"
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr "Abbrechen"
msgid "Change cover art" msgid "Change cover art"
msgstr "Titelbilder ändern" msgstr "Titelbilder ändern"

View File

@ -3,10 +3,10 @@
# This file is distributed under the same license as the Clementine package. # This file is distributed under the same license as the Clementine package.
# #
# Translators: # Translators:
# Adolfo Jayme-Barrientos, 2014 # Adolfo Jayme Barrientos, 2014
# Adolfo Jayme-Barrientos, 2018-2022 # Adolfo Jayme Barrientos, 2018-2022
# Adolfo Jayme-Barrientos, 2015-2016 # Adolfo Jayme Barrientos, 2015-2016
# Adolfo Jayme-Barrientos, 2014 # Adolfo Jayme Barrientos, 2014
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010 # FIRST AUTHOR <EMAIL@ADDRESS>, 2010
msgid "" msgid ""
msgstr "" msgstr ""
@ -14,7 +14,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-04-09 10:24+0000\n" "POT-Creation-Date: 2011-04-09 10:24+0000\n"
"PO-Revision-Date: 2011-10-27 18:53+0000\n" "PO-Revision-Date: 2011-10-27 18:53+0000\n"
"Last-Translator: Adolfo Jayme-Barrientos, 2018-2022\n" "Last-Translator: Adolfo Jayme Barrientos, 2018-2022\n"
"Language-Team: Esperanto (http://app.transifex.com/davidsansome/clementine/language/eo/)\n" "Language-Team: Esperanto (http://app.transifex.com/davidsansome/clementine/language/eo/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"

View File

@ -4,12 +4,12 @@
# #
# Translators: # Translators:
# Coroccotta <adiazubierna@gmail.com>, 2012 # Coroccotta <adiazubierna@gmail.com>, 2012
# Adolfo Jayme-Barrientos, 2014 # Adolfo Jayme Barrientos, 2014
# Adolfo Jayme-Barrientos, 2012-2013,2018,2021 # Adolfo Jayme Barrientos, 2012-2013,2018,2021
# Adolfo Jayme-Barrientos, 2016-2022 # Adolfo Jayme Barrientos, 2016-2022
# Adolfo Jayme-Barrientos, 2015-2016 # Adolfo Jayme Barrientos, 2015-2016
# Adolfo Jayme-Barrientos, 2013 # Adolfo Jayme Barrientos, 2013
# Adolfo Jayme-Barrientos, 2014 # Adolfo Jayme Barrientos, 2014
# Adrián Prado Castro <adrian.prado@gmail.com>, 2013 # Adrián Prado Castro <adrian.prado@gmail.com>, 2013
# Adrián Ramirez Escalante <buried.prophet@gmail.com>, 2012 # Adrián Ramirez Escalante <buried.prophet@gmail.com>, 2012
# Amaury Ortega <amauryocortega@gmail.com>, 2018 # Amaury Ortega <amauryocortega@gmail.com>, 2018

View File

@ -2185,7 +2185,7 @@ void MainWindow::AddFile() {
// Convert to URLs // Convert to URLs
QList<QUrl> urls; QList<QUrl> urls;
for (const QString& path : file_names) { for (const QString& path : file_names) {
urls << QUrl::fromLocalFile(QFileInfo(path).canonicalFilePath()); urls << QUrl::fromLocalFile(QFileInfo(path).absoluteFilePath());
} }
MimeData* data = new MimeData; MimeData* data = new MimeData;
@ -2209,7 +2209,7 @@ void MainWindow::AddFolder() {
// Add media // Add media
MimeData* data = new MimeData; MimeData* data = new MimeData;
data->setUrls(QList<QUrl>() << QUrl::fromLocalFile( data->setUrls(QList<QUrl>() << QUrl::fromLocalFile(
QFileInfo(directory).canonicalFilePath())); QFileInfo(directory).absoluteFilePath()));
AddToPlaylist(data); AddToPlaylist(data);
} }

View File

@ -69,7 +69,7 @@ QList<QUrl> FileViewList::UrlListFromSelection() const {
if (index.column() == 0) if (index.column() == 0)
urls << QUrl::fromLocalFile(static_cast<QFileSystemModel*>(model()) urls << QUrl::fromLocalFile(static_cast<QFileSystemModel*>(model())
->fileInfo(index) ->fileInfo(index)
.canonicalFilePath()); .absoluteFilePath());
} }
return urls; return urls;
} }

View File

@ -74,7 +74,7 @@ TEST_F(LibraryBackendTest, AddDirectory) {
// Check the signal was emitted correctly // Check the signal was emitted correctly
ASSERT_EQ(1, spy.count()); ASSERT_EQ(1, spy.count());
Directory dir = spy[0][0].value<Directory>(); Directory dir = spy[0][0].value<Directory>();
EXPECT_EQ(QFileInfo("/tmp").canonicalFilePath(), dir.path); EXPECT_EQ(QFileInfo("/tmp").absoluteFilePath(), dir.path);
EXPECT_EQ(1, dir.id); EXPECT_EQ(1, dir.id);
EXPECT_EQ(0, spy[0][1].value<SubdirectoryList>().size()); EXPECT_EQ(0, spy[0][1].value<SubdirectoryList>().size());
} }