show package contents

Mark Smith Mark_Smith at
Sat Dec 4 13:08:44 EST 2010

Hi Jacqueline, fooling around with this has certainly been instructive. I have 3 versions in play

1. the first has a hard coded path in the mainstack and that one obviously works from anywhere to call
the "one working copy" (currently Notepad4).
2. the second uses your suggested getStackPath function but does not put Notepad4 in the bundle. It
works fine if the mainstack and notepad4 are in the same directory, or the mainstack is on the application dock (which
functions, I suppose, just like a windows shortcut to the original)
3. the third uses getStackPath AND puts Notepad4 in the bundle. This works from anywhere, but obviously on a 
copy of notepad4.... but from my perspective getStackPath in this case is returning a relative path name...
relative to the mainstack. This, I think, would be the best way to distribute a
finished product to others since it puts everything in one neat and tidy place that can
be accessed relatively from anywhere?

And you got me there so thanks again!

-- Mark

PS here's what the current stack script for the main stack looks like (covers 2 and 3 above)

-- Use this startup when compiling to a distribution bundle. 
-- For compiler settings include Notepadx in the Stacks pane so it is included in the bundle

on preopenstack
   lock screen -- prevents the user from seeing what's going on
   hide this stack -- so they don't see it, same as set visible of stack "mystack" to true
   go to stack getStackPath ("Notepad4.rev")
end preopenstack

-- note this stack can be hard to edit subsequently because the preopenstack handler
-- hides the stack. You can get around this by using the application browser, finding the stack
-- 'startup' and clicking on it. This will make it visible again

function getStackPath pFilename
   put the effective filename of this stack into tPath  -- puts path to Startup.rev into tPath
   set the itemDelimiter to slash
   put pFilename into last item of tPath  -- replaces last item with Notepad4.rev
   return tPath
end getStackPath

From: use-livecode-bounces at [use-livecode-bounces at] On Behalf Of J. Landman Gay [jacque at]
Sent: Saturday, December 04, 2010 11:21 AM
To: How to use LiveCode
Subject: Re: show package contents

On 12/3/10 10:37 PM, Mark Smith wrote:
> Thanks Jacqueline.You are a terrific teacher. It not only worked but I
> understand it. It is a very clever technique. I am still using the old 'hard
> coded' method (as well) because it has the advantage that while I *use* the
> stack, and modify it, the notes get written to a common stack (not a "copy"
> of the stack where they might get trashed).

Thanks. But I kind of misinformed you. The function I wrote calculates a
hard-coded path, so it isn't reallly a relative one. But it works.

If you move your working notepad data stack into the mainstack's folder,
it will work as it does now. Any changes you make to it will be
permanent. The copy isn't made until you build a standalone. It's easier
to maintain only one working copy of a stack.

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list