Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 2387a18

Browse files
author
Monte Goulding
authored
Merge pull request #1871 from livecode/bugfix-sample_stacks_name_clash
[[ ExtensionSampleStacks ]] Fix name clash bug
2 parents e5ba453 + 5b9230c commit 2387a18

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

Toolset/palettes/extension manager/revideextensionmanagerlistbehavior.livecodescript

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,39 @@ on cancelExtensionInstall pExtensionIdentifier
186186
revIDECancelInstallExtension pExtensionIdentifier
187187
end cancelExtensionInstall
188188

189+
local sSampleFileName
190+
local sOpenedStacksA
189191
on launchExtensionSampleStack pSampleStack
192+
// Check if the sample stack has already been opened,
193+
// i.e. if its name is mapped in the array. If so, just
194+
// open it.
195+
if there is a stack (sOpenedStacksA[pSampleStack]) then
196+
open stack sOpenedStacksA[pSampleStack]
197+
exit launchExtensionSampleStack
198+
end if
199+
200+
// Otherwise open the stack from the file. Wait until we
201+
// get the openStack message before emptying the filename
202+
// otherwise we will get a long id clash
203+
revIDESubscribe "ideOpenStack"
204+
put pSampleStack into sSampleFileName
205+
190206
## Open the sample stack
191-
## Clear the filename to force the user to choose save location if saving the stack
192207
open stack pSampleStack
193-
set the filename of stack pSampleStack to empty
194208
end launchExtensionSampleStack
195209

210+
on ideOpenStack pCard
211+
local tStack
212+
put the long id of the owner of pCard into tStack
213+
if tStack is the long id of stack sSampleFileName then
214+
## Clear the filename to force the user to choose save location if saving the stack
215+
put the short name of tStack into sOpenedStacksA[sSampleFileName]
216+
set the filename of tStack to empty
217+
put empty into sSampleFileName
218+
revIDEUnsubscribe "ideOpenStack"
219+
end if
220+
end ideOpenStack
221+
196222
on ideExtensionStatusChanged pStatus
197223
local tElement, tRow, tIdentifier, tStatus, tProgress
198224
put item 1 of pStatus into tIdentifier

0 commit comments

Comments
 (0)