improve importScripts(): resolve relative path against WebWorker location instead of Current Working Directory
see issue #192
@audreyt I usually do not develop with C, so please have a look at the implementation to check if it is OK
Implementation Details
store location of WebWorker script as __filename:
in importScripts(), if imported path is not an absolute URL, resolve against path of WebWorker's __filename (or more precisely its directory)
special treatment of non-URL paths (i.e. system file paths): "guess" if system file path is absolute (i.e. using heuristics)
heuristic 1: store Current Working Directory in WebWorker instance as __cwd:
if system path is sub path to __cwd, treat as absolute (i.e. if __cwd is prefix of the path)
heuristic 2: introduce escape character '!' for manually marking a path as absolute:
if path starts with '!', treat the path as absolute path (i.e. do not resolve against WebWorker script location)
file-names that actually start with ! need to be escaped by adding another ! character, i.e. so that the file-name starts with !!
improve
importScripts()
: resolve relative path against WebWorker location instead of Current Working Directorysee issue #192
@audreyt I usually do not develop with C, so please have a look at the implementation to check if it is OK
Implementation Details
store location of WebWorker script as
__filename
:in
importScripts()
, if imported path is not an absolute URL, resolve against path of WebWorker's__filename
(or more precisely its directory)special treatment of non-URL paths (i.e. system file paths): "guess" if system file path is absolute (i.e. using heuristics)
__cwd
:if system path is sub path to
__cwd
, treat as absolute (i.e. if__cwd
is prefix of the path)'!'
for manually marking a path as absolute:if path starts with
'!'
, treat the path as absolute path (i.e. do not resolve against WebWorker script location)!
need to be escaped by adding another!
character, i.e. so that the file-name starts with!!