Marc Reichelt: Die Lösung

Beitrag lesen

Hallo an alle,

ich lege jetzt doch kein Verzeichnis /tmp/emff an, weil swfmill mir dann Probleme bereitet. Im Endeffekt habe ich jetzt eine gute Lösung gefunden:

1. Der Ordner ../temp/ wird angelegt.
2. Anschließend wird in diesen Ordner gewechselt.
3. Nun wird in diesem Ordner gearbeitet.
4. Anschließend wird der Ordner wieder gelöscht.

Auf diese Art und Weise erreiche ich es in jedem Fall, dass ich ein eigenes temporäres Verzeichnis habe. Super, jetzt kann ich endlich mit der Entwicklung des EMFF weitermachen! :-)

Hier die aktuellste Version des Codes (leider gibt es hier im Forum kein Syntax-Highlighting für Shell-Skripte):

<code file="createskin.sh">
#!/bin/bash

global options

path to MTASC binary

binarymtasc="mtasc"

path to ActionScript classes for MTASC

classpath="/usr/local/bin/std/"

path to swfmill binary

binaryswfmill="swfmill"

MTASC compile flags

mtascflags="-version 6 -strict -wimp -header 600:400:31"

temporary file for classes compiled by MTASC

tempcompilation="compilation.temp.swf"

input file MTASC

inputmtasc="Skin.as"

input file swfmill

inputswfmill="swfmill.xml"

directory for temporary files

tmpdir="../temp/"

clearUp() {
 cd ..
 if [ -d temp ]
 then
  rm -rf temp
 fi
}

check parameter

if [ "$1" == "" ]
then
 echo "usage: $0 <name of skin>"
 echo "  example: $0 standard"
 exit 0
fi

if [ -d "../skins/$1/" ] && [ -f "../skins/$1/$inputmtasc" ] && [ -f "../skins/$1/$inputswfmill" ]
then
 echo -n
else
 echo "the found directory seems to be no valid skin directory, aborting"
 exit 1
fi

make temp directory and change the working directory

if mkdir $tmpdir 2>/dev/null
then
 echo -n
else
 echo "could not create $tmpdir, aborting"
 exit 1
fi

if cd $tmpdir 2>/dev/null
then
 echo -n
else
 echo "fatal: could not change working directory to $tmpdir, aborting"
 exit 1
fi

execution of commands

copy all skin files into this temp directory

cp -rf ../skins/$1/* ./

create temporary file with compilation created by MTASC

$binarymtasc -cp $classpath -cp ../code/ $mtascflags $inputmtasc -swf $tempcompilation

create skin with swfmill

$binaryswfmill simple $inputswfmill "../skins/emff_$1.swf"

delete temporary files

clearUp

exit 0
</code>

Grüße

Marc Reichelt || http://www.marcreichelt.de/

--
Linux is like a wigwam - no windows, no gates and an Apache inside!
Selfcode: ie:{ fl:| br:> va:} ls:< fo:} rl:( n4:( ss:) de:> js:| ch:? sh:| mo:) zu:)