| Summary: | Amarok follows symlink - option to not do that | ||
|---|---|---|---|
| Product: | [Applications] amarok | Reporter: | Manuel Amador (Rudd-O) <rudd-o> |
| Component: | general | Assignee: | Amarok Bugs <amarok-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Fedora RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Make amarok not follow symlinks | ||
|
Description
Manuel Amador (Rudd-O)
2006-06-12 07:34:09 UTC
Created attachment 16564 [details]
Make amarok not follow symlinks
This patch enables amarok to skip symlinks when reading the collection.
Further discussion at: http://rudd-o.com/archives/2006/06/12/amarok-follows-symbolic-links-no-problem/ SVN commit 565974 by aoliveira:
Collection Scanner resolves symlinks, what avoids duplicating files when there's links that point to other folders inside of the
collection. Please test, this might create problems.
BUG: 129018
M +12 -0 collectionscanner.cpp
--- trunk/extragear/multimedia/amarok/src/collectionscanner/collectionscanner.cpp #565973:565974
@@ -27,6 +27,8 @@
#include <iostream>
#include <dirent.h> //stat
+#include <limits.h> //PATH_MAX
+#include <stdlib.h> //realpath
#include <taglib/audioproperties.h>
#include <taglib/fileref.h>
@@ -150,6 +152,7 @@
const QCString dir8Bit = QFile::encodeName( dir );
struct stat statBuf;
+ struct stat statBuf_symlink;
stat( dir8Bit, &statBuf );
struct direntry de;
@@ -197,6 +200,8 @@
if ( stat( entry, &statBuf ) != 0 )
continue;
+ if ( lstat( entry, &statBuf_symlink ) != 0 )
+ continue;
// loop protection
if ( ! ( S_ISDIR( statBuf.st_mode ) || S_ISREG( statBuf.st_mode ) ) )
@@ -204,6 +209,13 @@
if ( S_ISDIR( statBuf.st_mode ) && m_recursively && entry.length() && entryname[0] != '.' )
{
+ if ( S_ISLNK( statBuf_symlink.st_mode ) ) {
+ char nosymlink[PATH_MAX];
+ if ( realpath( entry, nosymlink ) ) {
+ debug() << entry << " is a symlink. Using: " << nosymlink << endl;
+ entry = nosymlink;
+ }
+ }
const QString file = QFile::decodeName( entry );
bool isInCollection = false;
|