bin/imager.restore
changeset 52 100c97dc02ca
parent 51 0b6b92d1eb65
child 72 2a7ab8422dd6
equal deleted inserted replaced
51:0b6b92d1eb65 52:100c97dc02ca
    11 
    11 
    12 use 5.010;
    12 use 5.010;
    13 use strict;
    13 use strict;
    14 use warnings;
    14 use warnings;
    15 use File::Basename;
    15 use File::Basename;
    16 use Cwd qw(abs_path);
       
    17 use autodie qw(:all);
    16 use autodie qw(:all);
    18 use Pod::Usage;
    17 use Pod::Usage;
    19 use Getopt::Long;
    18 use Getopt::Long;
    20 use Hash::Util qw(lock_keys);
    19 use Hash::Util qw(lock_keys);
    21 use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
    20 use IO::Uncompress::Gunzip qw(gunzip $GunzipError);
   114     close($out);
   113     close($out);
   115     close($fh);
   114     close($fh);
   116 }
   115 }
   117 
   116 
   118 sub find_data_dir {
   117 sub find_data_dir {
   119     for (my $dir = shift ; $dir ne "/" ; $dir = abs_path("$dir/..")) {
   118     for (my $dir = shift ; $dir ne "/" ; $dir = dirname $dir) {
   120         return "$dir/data" if -d "$dir/data" and -d "$dir/idx";
   119         return "$dir/data" if -d "$dir/data" and -d "$dir/idx";
   121     }
   120     }
   122     die ME . ": no data directory found!\n";
   121     die ME . ": no data directory found!\n";
   123 }
   122 }
   124 
   123