Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions engine/src/mode_standalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@ IO_stat MCDispatch::startup(void)
MCdispatcher -> loadexternal(MCSTR("revxml"));
MCdispatcher -> loadexternal(MCSTR("dbsqlite"));
MCdispatcher -> loadexternal(MCSTR("dbmysql"));
#elif defined(__EMSCRIPTEN__)
/* Don't load any externals */
#else
MCdispatcher -> loadexternal(MCSTR("revzip.dylib"));
MCdispatcher -> loadexternal(MCSTR("revdb.dylib"));
Expand Down
47 changes: 32 additions & 15 deletions ide-support/revsaveasemscriptenstandalone.livecodescript
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ command revSaveAsEmscriptenStandalone pStack, pOutputFolder
put tBuildFolder & slash & tName & ".html" into tHtmlFile
logDebug "html", "Creating" && tHtmlFile
logDebug "html", "Copying" && getHtmlTemplateFile()
revSBCopyFileToFile mapPath(getHtmlTemplateFile()), tHtmlFile, \
revSBCopyFileToFile mapBinPath(getHtmlTemplateFile()), tHtmlFile, \
"revStandaloneProgressCallback", the long id of me

catch tError
Expand Down Expand Up @@ -161,9 +161,9 @@ end revSaveAsEmscriptenStandalone
-- File & path helper functions
----------------------------------------------------------------

-- Map a file path into an absolute filesystem path. This is used to
-- cope with running from a git repository working tree.
private function mapPath pPath
-- Map a compiled file's path into an absolute filesystem path. This
-- is used to cope with running from a git repository working tree.
private function mapBinPath pPath
if there is a file pPath then
return pPath
end if
Expand All @@ -175,18 +175,32 @@ private function mapPath pPath
-- We're running from a git checkout
return getRepoBinariesFolder() & slash & pPath
end if
end mapPath
end mapBinPath

-- Map a resource file's path into an absolute filesystem path. This
-- is used to cope with running from a git repository working tree.
private function mapResPath pPath
if there is a file pPath then
return pPath
end if

if revEnvironmentIsInstalled() then
return getRuntimeFolder() & slash & pPath
else
return getRepoResourceFolder() & slash & pPath
end if
end mapResPath

-- Return a number-indexed array of engine files that need to be
-- copied into the standalone output folder.
private function getEngineFiles
local tFiles

-- Engine JavaScript
put mapPath("standalone-" & revLicenseType() & "-" & the version & ".js") into tFiles[1]
put mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".js") into tFiles[1]

-- Memory initialisation file
put mapPath("standalone-" & revLicenseType() & "-" & the version & ".html.mem") into tFiles[2]
put mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".html.mem") into tFiles[2]

return tFiles
end getEngineFiles
Expand All @@ -196,7 +210,7 @@ end getEngineFiles
-- initialisation data that's automatically included in all
-- standalones (especially fonts).
private function getStandaloneTemplateFolder
return mapPath("emscripten-standalone-template")
return mapResPath("emscripten-standalone-template")
end getStandaloneTemplateFolder

-- Return a number-indexed array of files in the Emscripten standalone
Expand Down Expand Up @@ -230,6 +244,11 @@ private command getStandaloneTemplateFiles_Impl @xCount, @xFiles, pRelPath

-- List files
repeat for each line tFile in the files
-- Skip dotfiles
if tFile begins with "." then
next repeat
end if

add 1 to xCount
put pRelPath & slash & tFile into tFilePath
put tFilePath into xFiles[xCount]
Expand All @@ -256,7 +275,7 @@ end getStandaloneTemplateFiles_Impl
-- This has some standalone-dependent JavaScript substituted into it
-- to instantiate the engine.
private function getHtmlTemplateFile
return mapPath("standalone-" & revLicenseType() & "-" & the version & ".html")
return mapBinPath("standalone-" & revLicenseType() & "-" & the version & ".html")
end getHtmlTemplateFile

-- Get the directory containing the Emscripten runtime
Expand Down Expand Up @@ -291,9 +310,7 @@ private function getRepoBinariesFolder
return revEnvironmentRepositoryPath() & slash & "emscripten-bin"
end getRepoBinariesFolder

---------------------------------------
-- FIXME REMOVE THESE

function revEmscriptenGetRepoBinariesFolder
return getRepoBinariesFolder()
end revEmscriptenGetRepoBinariesFolder
-- Get the directory where Emscripten resources are kept
private function getRepoResourceFolder
return revEnvironmentRepositoryPath() & slash & "engine" & slash & "rsrc"
end getRepoResourceFolder