This works, dont know why
This commit is contained in:
@@ -5,7 +5,7 @@ use strict;
|
||||
|
||||
use File::Find::Wanted;
|
||||
use File::Basename;
|
||||
use Cwd qw/ realpath abs_path /;
|
||||
use Cwd qw/getcwd abs_path/;
|
||||
use File::Spec;
|
||||
use File::Spec::Functions;
|
||||
use Image::EXIF;
|
||||
@@ -13,8 +13,8 @@ use Data::Dumper::Simple;
|
||||
use Math::Round;
|
||||
|
||||
my $conf = {
|
||||
src_dir => "pics",
|
||||
dst_dir => "links",
|
||||
src_dir => "./pics",
|
||||
dst_dir => "./links",
|
||||
};
|
||||
|
||||
# verify the source dir
|
||||
@@ -115,17 +115,15 @@ foreach my $f (keys %$files) {
|
||||
|
||||
# Construct the symlink path. TODO: use something smarter than just string
|
||||
# concatenation.
|
||||
my $name = basename($f);
|
||||
my $ar = $files->{$f}->{ar};
|
||||
my $symlink = $conf->{dst_dir} . "/" . $ar . "/" . $name;
|
||||
my $symlink_name = basename($f);
|
||||
my $symlink_dir = abs_path($conf->{dst_dir}) . "/" . $ar;
|
||||
my $symlink_path = File::Spec->abs2rel($symlink_dir . "/" . $symlink_name);
|
||||
|
||||
# Costruct the relative path that the symlink points to
|
||||
my $path = File::Spec->abs2rel(realpath($f), realpath($symlink));
|
||||
|
||||
print "f='$f' symlink='$symlink' path='$path' abs_path(f)='" . abs_path($f) . "'\n";
|
||||
my $f_path = File::Spec->abs2rel(abs_path($f));
|
||||
|
||||
# symlink
|
||||
print "symlink($path, $symlink);\n";
|
||||
print "symlink($f_path, $symlink_path);\n";
|
||||
}
|
||||
|
||||
# vim: set ts=4 sw=4 et cc=80:
|
||||
|
||||
Reference in New Issue
Block a user