relativise symbolic links
[id3fs.git] / lib / ID3FS / Fuse.pm
index 2a02276..bbf6f34 100644 (file)
@@ -4,6 +4,7 @@ use strict;
 use warnings;
 use ID3FS::Path;
 use Fuse;
+use Cwd;
 use POSIX qw(EINVAL EROFS ENOENT EOPNOTSUPP S_IRUSR S_IRGRP S_IROTH S_IXUSR S_IXGRP S_IXOTH);
 our ($TYPE_DIR, $TYPE_SYMLINK)=(0040, 0120);
 
@@ -16,7 +17,7 @@ sub new
 
     $self->{db}=shift;
     $self->{source}=shift;
-    $self->{mountpoint}=shift;
+    $self->{mountpoint}=Cwd::abs_path(shift);
     $self->{debug}=shift;
     $self->{perms} = S_IRUSR() | S_IXUSR() | S_IRGRP() | S_IXGRP() | S_IROTH() | S_IXOTH();
 
@@ -83,7 +84,7 @@ sub readlink
 #    print "**READLINK: $filename\n";
     my $path=ID3FS::Path->new($self->{db}, $filename);
     return(-EINVAL()) unless($path->isfile());
-    return $path->dest();
+    return $path->dest($self->{mountpoint});
 }
 
 sub getdir