Implement the code to copy custom files to the disk image in the build

This commit is contained in:
Jeremy Rand 2018-06-18 23:23:59 -04:00
parent 448ae4deb9
commit 7c7e6ab828
2 changed files with 65 additions and 5 deletions

View File

@ -208,9 +208,24 @@ SRCDIRS+=
# #
# Then, during the copy phase, mySystemFile will be copied into the root # Then, during the copy phase, mySystemFile will be copied into the root
# of the disk and anotherFile will be copied into a directory named # of the disk and anotherFile will be copied into a directory named
# newDir. Note that the build will _not_ create directories on your # newDir. The newDir directory will be created if it does not already
# destination disk image. You must make sure that this directory # exist.
# exists in the template disk image in the make directory already. #
# The name of the file to copy is checked and if it ends in:
# .as - It assumes the file is in AppleSingle format. The .as
# suffix is stripped from the name when copied to the
# disk image.
# .<char> - If the file ends with a single character which matches
# a DOS 3.3 file type (A, B, T, etc) it uses that value as
# the file type of the file copied to the disk image. The
# single character is removed from the file name.
# .<TLA> - If the file ends with a three letter alpha extension, it
# uses that TLA as the file type of the file copied to the
# disk image. The TLA is removed from the file name.
#
# If you do not provide any type information for your filenames,
# it will be copied as a binary.
#
COPYDIRS= COPYDIRS=
# Add any rules you want to execute before any compiles or assembly # Add any rules you want to execute before any compiles or assembly

View File

@ -218,6 +218,51 @@ fi
for DIR in $* for DIR in $*
do do
echo Write the code to copy $DIR to the disk image if [ ! -d "$DIR" ]
then
echo Unable to find directory $DIR
exit 1 exit 1
fi
OLDPWD=`pwd`
cd $DIR
find . -type f -print | while read FILE
do
TRANSFERARG=-p
FILETYPE=bin
DESTFILE=`echo $FILE | sed 's/^\.\///'`
if echo $FILE | egrep '\.as$' > /dev/null
then
# If the file ends with .as, this means the input is AppleSingle format.
# Strip the .as from the end of the file name and set the args to do
# an AppleSingle transfer.
TRANSFERARG=-as
FILETYPE=""
DESTFILE=`echo $DESTFILE | sed 's/\.as$//'`
elif echo $FILE | egrep '\.[ABITSRab]$' > /dev/null
then
# If the file ends with a single character DOS 3.3 file type, then use
# that as the file type.
FILETYPE=`echo $DESTFILE | awk -F. '{print $NF}'`
DESTFILE=`echo $DESTFILE | sed 's/\.[ABITSRab]$//'`
elif echo $FILE | egrep '\.[a-zA-Z][a-zA-Z][a-zA-Z]$' > /dev/null
then
# If the file ends with a three letter extension, use that as
# the file type.
FILETYPE=`echo $DESTFILE | awk -F. '{print $NF}'`
DESTFILE=`echo $DESTFILE | sed 's/\.[a-zA-Z][a-zA-Z][a-zA-Z]$//'`
fi
# If the file type is text, convert the line feeds to carriage return
if [ $FILETYPE = txt ] || [ $FILETYPE = T ]
then
tr '\n' '\r' < $FILE | "$JAVA" -jar "$OLDPWD/$APPLECOMMANDER" $TRANSFERARG "$OLDPWD/$DISKIMAGE" "$DESTFILE" $FILETYPE
else
"$JAVA" -jar "$OLDPWD/$APPLECOMMANDER" $TRANSFERARG "$OLDPWD/$DISKIMAGE" "$DESTFILE" $FILETYPE < $FILE
fi
done
cd "$OLDPWD"
done done