• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Editing a shell included in Bundle contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing a shell included in Bundle contents


  • Subject: Re: Editing a shell included in Bundle contents
  • From: "Mark J. Reed" <email@hidden>
  • Date: Tue, 11 Oct 2005 07:45:52 -0400

First, a minor terminology quibble: the "shell" is the program
responsible for executing shell commands; besides being run when you
execute a "do shell script" or invoke a program that is written in the
shell, it's also the application you are interacting with when you
type in a Terminal window.  A program written in the shell's language
is called a "shell program" or, more commonly, a "shell script"; it is
not itself a "shell".

I bring this up not because of my inner pedant struggling to get free,
but simply because your subject line genuinely confused me at first.
:)

So, to sum up the problem: you have a shell script included in your
application bundle that references a resource contained on your
machine, but you want the ability to include that resource in the
bundle instead.

It sounds like you don't need the ability to edit the shellscript on
the fly; you just need to modify it once so that it refers to the file
relative to the bundle.   I don't know how a shellscript run from
inside an app bundle can figure out where that bundle lives, however.

If you want to be able to change which file is used on the fly every
time you run the command, that's easy, too.  Here's one way:

#!/bin/bash
# begin mute_convert

SOUND_DIR="/Applications/GalleryMaker 2.16/resources/template-dvd/sounds"
FFMPEG="/opt/darwinports/bin/ffmpeg"

function convertFile()
{
     local soundFile=silence.mp2
     case "$1" in
            -s) soundFile="$2"; shift 2;;
            -s*) soundFile="${1#-s}"; shift;
    esac

    case "$soundFile" in
         /*) :;;
        *) soundFile="${SOUND_DIR}/$soundFile";;
    esac

    "$FFMPEG" -y -i "$soundFile" -i "$1" -target pal-dvd -aspect 4:3
-acodec mp2 -ab 128a \
                           -vcodec mpeg2video -b 3000 -g 25 "$2"
}

convertFile "$@"

# end mute_convert

What the above does is let you run

             convertFile foo bar

just like now, but you can also run

                convertFIle -s someSoundFile foo bar

Which means you can do the figuring out where the file lives in the
bundle part in AppleScript instead of the shell, if that helps.
--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Editing a shell included in Bundle contents (From: Jay Louvion <email@hidden>)

  • Prev by Date: Re: Editing a shell included in Bundle contents
  • Next by Date: Re: Editing a shell included in Bundle contents
  • Previous by thread: Re: Editing a shell included in Bundle contents
  • Next by thread: Creator type of Script Debugger files
  • Index(es):
    • Date
    • Thread