1 # GIMP - The GNU Image Manipulation Program
2 # Copyright (C) 1998-2003 Manish Singh <yosh@gimp.org>
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 package Gimp
::CodeGen
::util
;
19 use File
::Basename
'basename';
21 use File
::Compare
'cmp';
23 $DEBUG_OUTPUT = exists $ENV{PDBGEN_BACKUP
} ?
$ENV{PDBGEN_BACKUP
} : 1;
25 $FILE_EXT = ".tmp.$$";
31 my $realfile = basename
($file);
32 $realfile =~ s/$FILE_EXT$//;
33 $realfile = "$destdir/$realfile";
36 if (cmp($realfile, $file)) {
37 cp
($realfile, "$realfile~") if $DEBUG_OUTPUT;
39 print "Wrote $realfile\n";
42 print "No changes to $realfile\n";
47 rename $file, $realfile;
48 print "Wrote $realfile\n";