andreyvit/yoursway-create-dmg — Issue #7: Spaces is path causes error
Author: seyDoggy
Created: 2012-01-25 17:40:35+00:00
State: open

It doesn't matter whether you escape the spaces or put the path in quotes, but having spaces in the path cause the script to fail. For example this path `~/some/path/my folderName/` causes the following errors:

/usr/local/bin/create-dmg: line 102: cd: Users/user/some/path/my: No such file or directory
/usr/local/bin/create-dmg: line 115: [: /Users/user/some/path/my: binary operator expected
Creating disk image...
du: /Users/user/some/path/my: No such file or directory
du: folderName: No such file or directory

To fix the errors, make the following changes to these line numbers:

102 DMG_DIR="$(cd "$DMG_DIRNAME" > /dev/null; pwd)"

115 if [ -f "$SRC_FOLDER"/.DS_Store ]; then

123 ACTUAL_SIZE=`du -sm "$SRC_FOLDER" | sed -e 's/	.*//g'`