[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Re: "Uncompressed XML Files" format variants
From:       Jos van den Oever <jos.van.den.oever () kogmbh ! com>
Date:       2012-11-12 21:00:09
Message-ID: 50A16359.6060103 () kogmbh ! com
[Download RAW message or body]

On 11/12/2012 09:56 PM, Friedrich W. H. Kossebau wrote:
> Am Montag, 12. November 2012, 17:10:09 schrieb Inge Wallin:
>> Would you go for disable saving and still allow loading? That way you won't
>> destroy for those few that actually have uncompressed odf files out there.
>
> Hm, what about a small script instead which transforms the uncompressed files
> into a fod* or od* instead?

Here you go.






["pack" (text/plain)]

#! /bin/bash

DIR=${1%/}
OUTPUT=$2

if [ ! -d "$DIR" ]; then
	echo "Provide a directory to pack."
	exit 1
fi
if [ -z "$OUTPUT" ]; then
	BASE=${DIR%_*}
	EXT=${DIR##*_}
	if [ "${BASE}_$EXT" != "$DIR" ]; then
		echo "Provide output name or use directory like 'name_ext'."
		exit 1
	fi
	OUTPUT="$BASE.$EXT"
fi
if [ ${OUTPUT:0:1} != "/" ]; then
	OUTPUT="$PWD/$OUTPUT"
fi

if [ ! -f "$DIR/mimetype" ]; then
	echo "No mimetype file present."
	exit 1
fi
if [ ! -f "$DIR/content.xml" ]; then
	echo "No content.xml file present."
	exit 1
fi
if [ ! -f "$DIR/styles.xml" ]; then
	echo "No styles.xml file present."
	exit 1
fi
if [ -f "$OUTPUT" ]; then
	rm "$OUTPUT"
fi

cd "$DIR"
zip -D -X -0 "$OUTPUT" mimetype
zip -D -X -9 -r "$OUTPUT" . -x mimetype \*/.\* .\* \*.png \*.jpg \*.jpeg
zip -D -X -0 -r "$OUTPUT" . -i \*.png \*.jpg \*.jpeg
echo Created "$OUTPUT"


_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic