SVN: toys/rsget.pl: README.config RSGet/FileList.pm
sparky
sparky at pld-linux.org
Tue Oct 6 00:07:12 CEST 2009
Author: sparky
Date: Tue Oct 6 00:07:11 2009
New Revision: 10695
Modified:
toys/rsget.pl/README.config
toys/rsget.pl/RSGet/FileList.pm
Log:
- fix list file locking for files not in current directory
Modified: toys/rsget.pl/README.config
==============================================================================
--- toys/rsget.pl/README.config (original)
+++ toys/rsget.pl/README.config Tue Oct 6 00:07:11 2009
@@ -27,6 +27,9 @@
# if your vim stores swap files in different directory and you want list
# file locking:
#list_lock = /path/to/swaps/.${file}.swp
+# list will be manipulated by some external app which creates .lock file
+# in the same directory as list file:
+#list_lock = ${dir}/.lock
# store unfinished files in "partial" directory
workdir = partial
Modified: toys/rsget.pl/RSGet/FileList.pm
==============================================================================
--- toys/rsget.pl/RSGet/FileList.pm (original)
+++ toys/rsget.pl/RSGet/FileList.pm Tue Oct 6 00:07:11 2009
@@ -7,7 +7,7 @@
set_rev qq$Id$;
def_settings(
- list_lock => [ "If lock file exists, list file won't be updated.", '.${file}.swp', qr/.+/ ],
+ list_lock => [ "If lock file exists, list file won't be updated.", '${dir}/.${file}.swp', qr/.+/ ],
list_file => [ "Use specified file as URI list.", undef, qr/.+/ ],
);
@@ -43,8 +43,21 @@
p "Using '$file' file list\n";
}
die "Can't read '$file'\n" unless -r $file;
- ( $file_swp = setting( "list_lock" ) ) =~ s/\${file}/$file/g;
- p "Using '$file_swp' as file lock\n";
+
+ {
+ my ( $dir, $fn );
+ if ( $file =~ m{^(.*)/(.*?)$} ) {
+ $dir = $1;
+ $fn = $2;
+ } else {
+ $dir = '.';
+ $fn = $file;
+ }
+ $file_swp = setting( "list_lock" );
+ $file_swp =~ s/\${file}/$fn/g;
+ $file_swp =~ s/\${dir}/$dir/g;
+ p "Using '$file_swp' as file lock\n";
+ }
}
sub update
More information about the pld-cvs-commit
mailing list