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

Commit c2e26b8

Browse files
committed
[[ ScriptExtensions ]] Fix packaging script
Remove pushd as it is a bash extension and therefore does not always work when used with a block of shell script executed from LC
1 parent eb7c146 commit c2e26b8

File tree

1 file changed

+24
-41
lines changed

1 file changed

+24
-41
lines changed

util/package_extension.livecodescript

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,42 @@ command extractDocs pEnginePath, pExtractScript, pDocsParser, pSourceFolder, pSo
5252
end if
5353
end extractDocs
5454

55-
command packageScriptExtension pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
56-
local tExtShortName
57-
set the itemdelimiter to "."
58-
put item -2 of pSourceFileName into tExtShortName
59-
55+
private command packageExtension pExtensionName, pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
6056
local tTargetDir, tBuildTarget, tZip
61-
put "com.livecode.library." & tExtShortName into tTargetDir
57+
put pExtensionName into tTargetDir
6258
put pTargetFolder & slash & tTargetDir into tBuildTarget
6359
put pSourceFolder & slash & tTargetDir & ".lce" into tZip
6460

65-
local tShell
66-
put "pushd" && q(pSourceFolder) && "1>/dev/null" into tShell
67-
put return & "zip -q -r " & tTargetDir & ".lce *" after tShell
68-
put return & "popd 1>/dev/null" after tShell
69-
put return & "mkdir -p " & q(tBuildTarget) after tShell
70-
put return & "unzip -q -o " & q(tZip) && \
71-
"-d " & q(tBuildTarget) after tShell
61+
local tShell, tCurFolder
62+
put the folder into tCurFolder
63+
put "cd" && q(pSourceFolder) into tShell
64+
put return & "zip -q -r" && tTargetDir & ".lce *" after tShell
65+
put return & "cd" && q(tCurFolder) after tShell
66+
put return & "mkdir -p" && q(tBuildTarget) after tShell
67+
put return & "unzip -q -o " & q(tZip) && "-d " & q(tBuildTarget) \
68+
after tShell
7269
put return & "rm" && q(tZip) after tShell
7370

7471
if pRemoveSource is "true" then
75-
put return & "rm" && quote & tBuildTarget & slash & \
76-
pSourceFileName & quote after tShell
72+
put return & "rm" && q(tBuildTarget & slash & pSourceFileName) \
73+
after tShell
7774
end if
7875

76+
write "packaging extension" && pSourceFileName & return to stdout
7977
get shell(tShell)
8078
if the result is not 0 then
8179
write "subprocess error when packaging extension" && pSourceFileName & ":" && it to stderr
8280
quit 3
8381
end if
82+
end packageExtension
83+
84+
command packageScriptExtension pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
85+
local tExtShortName
86+
set the itemdelimiter to "."
87+
put item -2 of pSourceFileName into tExtShortName
88+
89+
packageExtension "com.livecode.library." & tExtShortName, \
90+
pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource
8491
end packageScriptExtension
8592

8693
command packageBuilderExtension pSourceFolder, pSourceFileName, pTargetFolder, pRemoveSource, pLCCompile, pInterfaceFolder
@@ -110,32 +117,8 @@ command packageBuilderExtension pSourceFolder, pSourceFileName, pTargetFolder, p
110117
quit 3
111118
end if
112119

113-
local tTargetDir, tBuildTarget, tZip
114-
put tExtensionName into tTargetDir
115-
put pTargetFolder & slash & tTargetDir into tBuildTarget
116-
put pSourceFolder & slash & tTargetDir & ".lce" into tZip
117-
118-
local tShell
119-
put "pushd" && quote & pSourceFolder & quote && "1>/dev/null" into tShell
120-
put return & "zip -q -r " & tTargetDir & ".lce *" after tShell
121-
put return & "popd 1>/dev/null" after tShell
122-
put return & "mkdir -p " & quote & tBuildTarget & quote after tShell
123-
put return & "unzip -q -o " & quote & tZip & quote && \
124-
"-d " & quote & tBuildTarget & quote after tShell
125-
put return & "rm" && quote & tZip & quote after tShell
126-
127-
if pRemoveSource is "true" then
128-
put return & "rm" && quote & tBuildTarget & slash & \
129-
pSourceFileName & quote after tShell
130-
end if
131-
132-
write "packaging extension" && pSourceFileName & return to stdout
133-
get shell(tShell)
134-
if the result is not 0 then
135-
write "subprocess error when packaging extension" && pSourceFileName & ":" && it to stderr
136-
quit 3
137-
end if
138-
120+
packageExtension tExtensionName, pSourceFolder, pSourceFileName, \
121+
pTargetFolder, pRemoveSource
139122
end packageBuilderExtension
140123

141124
on errorDialog tError

0 commit comments

Comments
 (0)