projects
/
id3fs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix relativising symlinks
[id3fs.git]
/
lib
/
ID3FS
/
DB.pm
diff --git
a/lib/ID3FS/DB.pm
b/lib/ID3FS/DB.pm
index
273f6dc
..
984bec0
100644
(file)
--- a/
lib/ID3FS/DB.pm
+++ b/
lib/ID3FS/DB.pm
@@
-37,6
+37,7
@@
sub new
my $init=shift;
$self->{base}=shift;
$self->{dbpath}=shift || ($self->{base} . "/" . $dbfile);
my $init=shift;
$self->{base}=shift;
$self->{dbpath}=shift || ($self->{base} . "/" . $dbfile);
+ $self->{dbpath}=Cwd::abs_path($self->{dbpath});
$self->{absbase}=Cwd::abs_path($self->{base});
my $connectstr="dbi:SQLite:dbname=$self->{dbpath}";
$self->{absbase}=Cwd::abs_path($self->{base});
my $connectstr="dbi:SQLite:dbname=$self->{dbpath}";
@@
-184,20
+185,21
@@
sub tag_has_values
sub relativise
{
sub relativise
{
- my($self, $path, $name, $mountpoint)=@_;
- my $id3fs_path=$self->{dbpath};
- $id3fs_path=~s/(.*)\/.*/$1/;
+ my($self, $path, $name, $mountpoint, $querypath)=@_;
my $rpath="$self->{absbase}/$path";
my $rpath="$self->{absbase}/$path";
- my $vpath=
"$mountpoint/$id3fs_path"
;
+ my $vpath=
$mountpoint . $querypath
;
my @path=split(/\//,$rpath);
my @rel=split(/\//,$vpath);
my @path=split(/\//,$rpath);
my @rel=split(/\//,$vpath);
- #absolute paths have empty first element due to leading /
+ # drop filename from rel
+ pop @rel;
+ # absolute paths have empty first element due to leading /
shift(@path) if($path[0] eq "");
shift(@rel) if($rel[0] eq "");
if($path[0] ne $rel[0])
{
shift(@path) if($path[0] eq "");
shift(@rel) if($rel[0] eq "");
if($path[0] ne $rel[0])
{
- #no path in common, return absolute
- print "FAIL: NO PATHS IN COMMON\n";
+ # no path in common, return absolute
+ # should never happen
+ # FIXME
return $name;
}
# f: /home/foo/bar/baz.mp3
return $name;
}
# f: /home/foo/bar/baz.mp3