diff options
Diffstat (limited to 'src/library_browser.js')
-rw-r--r-- | src/library_browser.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/library_browser.js b/src/library_browser.js index 0db2cc44..4a322a54 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -3,6 +3,7 @@ // Utilities for browser environments mergeInto(LibraryManager.library, { + $Browser__deps: ['$PATH'], $Browser__postset: 'Module["requestFullScreen"] = function(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports 'Module["requestAnimationFrame"] = function(func) { Browser.requestAnimationFrame(func) };\n' + 'Module["pauseMainLoop"] = function() { Browser.mainLoop.pause() };\n' + @@ -545,10 +546,9 @@ mergeInto(LibraryManager.library, { emscripten_async_wget: function(url, file, onload, onerror) { var _url = Pointer_stringify(url); var _file = Pointer_stringify(file); - var index = _file.lastIndexOf('/'); FS.createPreloadedFile( - _file.substr(0, index), - _file.substr(index +1), + PATH.dirname(_file), + PATH.basename(_file), _url, true, true, function() { if (onload) Runtime.dynCall('vi', onload, [file]); @@ -623,10 +623,9 @@ mergeInto(LibraryManager.library, { var _file = Pointer_stringify(file); var data = FS.analyzePath(_file); if (!data.exists) return -1; - var index = _file.lastIndexOf('/'); FS.createPreloadedFile( - _file.substr(0, index), - _file.substr(index +1), + PATH.dirname(_file), + PATH.basename(_file), new Uint8Array(data.object.contents), true, true, function() { if (onload) Runtime.dynCall('vi', onload, [file]); @@ -646,7 +645,7 @@ mergeInto(LibraryManager.library, { var cname = _malloc(name.length+1); writeStringToMemory(name, cname); FS.createPreloadedFile( - '', + '/', name, {{{ makeHEAPView('U8', 'data', 'data + size') }}}, true, true, |