update dev300-m58
[ooovba.git] / helpcontent2 / helpers / create_ilst.pl
blob3f07fe33ec075f9bc518e388296c617af8a7af73
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 #
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: create_ilst.pl,v $
14 # $Revision: 1.6 $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
35 # creates the ilst control file for the
36 # help specific images
38 use File::Find;
40 $params = join "|", "",@ARGV,"";
41 ($params =~ /-dir/) ? ($startdir = $params) =~ (s/.*-dir=([^\|]*).*$/$1/gs) : (($startdir = `pwd`) =~ s/\n//gs);
42 ($params =~ /-pre/) ? ($pre = $params) =~ (s/.*-pre=([^\|]*).*$/$1/gs) : ($pre = "helpimg");
44 my $startdir_regexp = quotemeta($startdir);
47 if ( -d $startdir ) {
48 find(sub{push @files, $File::Find::name if (($File::Find::name=~/\.png$/));},$startdir);
49 foreach ( @files ) { s#.*$startdir_regexp[\\/]##; };
50 for (sort(@files)) {
51 print "%GLOBALRES%/$pre/$_\n";
53 } else {
54 &terminate("Cannot find $startdir.");
58 sub terminate {
59 $err = shift;
60 printf STDERR "$err\n\n";
61 $msg = <<"MSG";
62 create_ilst.pl -dir=directory [-pre=string]
63 -dir root directory for the help images to
64 be searched (default=current dir)
65 Only *.png will be found.
66 -pre define directory prefix (default=helpimg)
68 MSG
69 die "$msg\n";