[Scummvm-git-logs] scummvm master -> 9ae226d2086e85aaf47302703cf306cf61fa14bb
sev-
sev at scummvm.org
Thu Sep 3 14:48:21 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9ae226d208 DEVTOOLS: Major improvements to encode-macbinary.sh
Commit: 9ae226d2086e85aaf47302703cf306cf61fa14bb
https://github.com/scummvm/scummvm/commit/9ae226d2086e85aaf47302703cf306cf61fa14bb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-09-03T16:48:04+02:00
Commit Message:
DEVTOOLS: Major improvements to encode-macbinary.sh
- Support for Japanese names which are converted to UTF-8 with 'recode'
- Support for files starting with '-' (avoid clash with options)
- Support for files contianing '{' (avoid hfs globbing clash)
- Support for files containing '/', it is replaced with ':'
- Support for empty directories, no more warnings
For Japanese mode filenames are correctly recoded back to HFS names, so
hutils are happy
Changed paths:
devtools/encode-macbinary.sh
diff --git a/devtools/encode-macbinary.sh b/devtools/encode-macbinary.sh
index e9465c10d7..25b2b5f1b7 100755
--- a/devtools/encode-macbinary.sh
+++ b/devtools/encode-macbinary.sh
@@ -14,8 +14,9 @@ Mode 1:
Operate in MacBinary encoding mode
Mode 2:
- $0 <file.iso>
+ $0 [jap] <file.iso>
Operate in disk dumping mode
+ Optionally specify 'jap' for using 'recode' for converting Japanese file names
Miscellaneous:
-h, --help display this help and exit
@@ -23,6 +24,7 @@ EOF
}
path=
+jap=
macbinarydump() {
mypath=`realpath $0`
@@ -45,31 +47,52 @@ macbinarydump() {
}
hfsdump() {
- IFS=$'\n'
mypath=`realpath $0`
- for i in `hls -F1a`
- do
+ if [[ jap == "jap" ]] ; then
+ flist=`hls -F1a|recode SJIS..utf-8`
+ else
+ flist=`hls -F1a`
+ fi
+
+ echo "$flist" | while read i ; do
+ if [[ jap == "jap" ]] ; then
+ macname=`echo "$i"|recode utf-8..SJIS`
+ else
+ macname="$i"
+ fi
+
+ # Guard empty directories
+ if [[ "$i" == "" ]] ; then
+ continue
+ fi
+
if [[ "$i" =~ ":" ]] ; then
- dir="${i%?}"
- hcd "$dir"
- mkdir "$dir"
- cd "$dir"
- bash $mypath hfsutils-phase2 "$path:$i"
+ dir="${i%?}" # Strip trailing ':'
+ dir="${dir//\//:}" # Files could contain '/', replace those with ':'
+ macdir="${macname%?}"
+ hcd "$macdir"
+ mkdir -- "$dir"
+ cd -- "$dir"
+ bash $mypath $jap hfsutils-phase2 "$path:$i"
hcd ::
cd ..
else
echo -ne "$path$i... \r"
# Executable files have star at their end. Strip it
if [[ "$i" =~ \*$ ]] ; then
+ macfile="${macname%?}"
file="${i%?}"
else
+ macfile="$macname"
file="$i"
fi
- fileunix="$file"
- # Files count contain stars
- file="${file//\*/\\*}"
- hcopy -m "$file" "./$fileunix"
+ fileunix="${file//\//:}" # Files could contain '/', replace those with ':'
+
+ # Files could contain '*', '{', so backslash them to avoid globbing
+ macfile="${macfile//\*/\\*}"
+ macfile="${macfile//{/\\{}"
+ hcopy -m -- "$macfile" "./$fileunix"
fi
done
}
@@ -82,7 +105,7 @@ for parm in "$@" ; do
done # for parm in ...
if [[ $1 == "macbinary" ]] ; then
- if test ! `type macbinary >/dev/null 2>/dev/null` ; then
+ if ! `command -v macbinary >/dev/null 2>/dev/null` ; then
echo "macbinary not found. Exiting"
exit 1
fi
@@ -104,6 +127,16 @@ if [ "$#" -lt 1 ] ; then
exit 1
fi
+if [[ $1 == "jap" ]] ; then
+ if ! `command -v recode >/dev/null 2>/dev/null` ; then
+ echo "recode not found. Exiting"
+ exit 1
+ fi
+
+ jap=jap
+ shift
+fi
+
if [[ $1 == "hfsutils-phase2" ]] ; then
path=$2
hfsdump
More information about the Scummvm-git-logs
mailing list