sveinbjornt / Platypus

Create native Mac applications from command line scripts.
https://sveinbjorn.org/platypus
BSD 3-Clause "New" or "Revised" License
2.84k stars 171 forks source link

ZIP in shell file won't work #238

Closed M-Rick closed 1 year ago

M-Rick commented 2 years ago

When I create a new droplet application and ask to zip a file, Platypus won't execute the command.

In the following code, Platypus will create the concatenated file in XML, but won't execute the code after, to zip the XML and remove the 2 files File1.txt and File2.txt

It works perfectly when using Automator.

#! /bin/sh

for f in "$@"
do

NAME=$(basename -- "$f") ; NAME="${NAME%.*}" ; NAME=$( echo "$NAME" | sed 's/_/ /g');

# Concatenate File 1 & 2
cat "$HOME"/File1.txt "$HOME"/File2.txt > "$HOME"/"$NAME".xml

# Create swatchbook file
zip "$NAME".zip "$NAME".xml
rm -f File1.txt File2.txt "$NAME".xml

done
sveinbjornt commented 1 year ago

The default current working directory when script is launched is [AppName].app/Contents/Resources within the application bundle. You seem to be assuming it's the user's home folder.