Browse Subversion Repository
Contents of /branches/4-stable/doc/htmlhelp_update_check.pl
Parent Directory
| Revision Log
Revision 8437 -
( show annotations)
( download)
( as text)
Fri Dec 13 03:11:16 2019 UTC
(4 years, 2 months ago)
by doda
File MIME type: text/x-perl
File size: 1270 byte(s)
Tera Term 4.xx メンテナンス用ブランチを作成
| 1 |
#! /usr/bin/perl |
| 2 |
|
| 3 |
# |
| 4 |
# HTMLヘルプソースがひとつでも更新されているかチェックする |
| 5 |
# |
| 6 |
# Usage(ActivePerl): |
| 7 |
# perl htmlhelp_update_check.pl ja chm_file_name |
| 8 |
# |
| 9 |
|
| 10 |
use Cwd; |
| 11 |
@dirstack = (); |
| 12 |
|
| 13 |
$ret = do_main($ARGV[0], $ARGV[1]); |
| 14 |
if ($ret) { |
| 15 |
print "updated"; |
| 16 |
} |
| 17 |
|
| 18 |
exit(0); |
| 19 |
|
| 20 |
sub do_main { |
| 21 |
my($path, $chm) = @_; |
| 22 |
my(@filestat) = stat "$path/$chm"; |
| 23 |
|
| 24 |
return get_file_paths($path, $filestat[9]); |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
sub get_file_paths { |
| 29 |
my ($top_dir, $chmupdated)= @_; |
| 30 |
my @paths=(); |
| 31 |
my @temp = (); |
| 32 |
|
| 33 |
#-- カレントの一覧を取得 --# |
| 34 |
opendir(DIR, $top_dir); |
| 35 |
@temp = readdir(DIR); |
| 36 |
closedir(DIR); |
| 37 |
foreach my $path (sort @temp) { |
| 38 |
next if( $path =~ /^\.{1,2}$/ ); # '.' と '..' はスキップ |
| 39 |
next if( $path =~ /^\.svn$/ ); # '.svn' はスキップ |
| 40 |
next if( $path =~ /^.\.chm$/ ); # '*.chm' はスキップ |
| 41 |
|
| 42 |
my $full_path = "$top_dir" . '/' . "$path"; |
| 43 |
|
| 44 |
if( -d "$top_dir/$path" ){ #-- ディレクトリの場合は自分自身を呼び出す |
| 45 |
if (&get_file_paths("$full_path", $chmupdated)) { |
| 46 |
return 1; |
| 47 |
} |
| 48 |
} else { |
| 49 |
if (&check_file($full_path, $chmupdated)) { |
| 50 |
return 1; |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
return 0; |
| 55 |
} |
| 56 |
|
| 57 |
sub check_file { |
| 58 |
my($filename, $chmupdated) = @_; |
| 59 |
my(@filestat) = stat $filename; |
| 60 |
|
| 61 |
if ($filestat[9] > $chmupdated) { |
| 62 |
return 1; |
| 63 |
} |
| 64 |
return 0; |
| 65 |
} |
|