[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: [PATCH] KOfffice 1.1 conversion script
From: Nicolas Goutte <nicog () snafu ! de>
Date: 2002-06-19 19:57:35
[Download RAW message or body]
The attached patch is for the file lib/store/fix_storage.pl
Features:
- add PID to all fixed file and directory names, so that the script can run
multiple times at once.
- replace the picture tags by image tags.
- permit the destination file to be defined by an absolute path.
Have a nice day/evening/night!
["patch.txt" (text/plain)]
Index: fix_storage.pl
===================================================================
RCS file: /home/kde/koffice/lib/store/fix_storage.pl,v
retrieving revision 1.4
diff -u -r1.4 fix_storage.pl
--- fix_storage.pl 2002/04/13 07:16:12 1.4
+++ fix_storage.pl 2002/06/19 19:36:42
@@ -5,10 +5,15 @@
# A small script to convert current-style KOffice tar storages to storages
# compatible with KOffice 1.0 and KOffice 1.1(.1)
+# Note to developers:
+# Add the PID (in Perl: $$ ) to all fixed temporary directory/file names,
+# so that this script can be run multiple times at once.
+
# Holds the directory tree
my @rootdir;
-my $tmpdir = "/tmp/kofficeconverter";
-# Holds the soucre/dest of the files to fix
+my $tmpdir = "/tmp/kofficeconverter$$" ;
+print "Using temporary directory... $tmpdir\n";
+# Holds the source/dest of the files to fix
my @needFixing;
# Walk the whole archive and collect information about the files
@@ -102,6 +107,15 @@
}
return $tmp;
}
+# Replace pictures by images, as cliparts will never work with only this script.
+ elsif($line =~ m%\s*\<PICTURE%) {
+ $line =~ s%\<PICTURES\>%\<PIXMAPS\>% ;
+ $line =~ s%\<PICTURE\>%\<IMAGE\>% ;
+ }
+ elsif($line =~ m%\s*\</PICTURE%) {
+ $line =~ s%\</PICTURES\>%\</PIXMAPS\>% ;
+ $line =~ s%\</PICTURE\>%\</IMAGE\>% ;
+ }
return $line;
}
@@ -189,8 +203,9 @@
print "Creating the archive...\n";
chdir($tmpdir);
-system("tar czf tmp.tgz *");
-system("mv tmp.tgz $cwd/$ARGV[1]");
+system("tar czf tmp$$.tgz *");
+chdir ($cwd);
+system("mv $tmpdir/tmp$$.tgz $ARGV[1]");
print "Cleaning up...\n";
# clean up properly
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic