Update current directory magic in runtime.js

Previous behaviour caused build problems on Windows. New logic does the
same thing (effectively) as the previous implementation (i.e., if the
script path is relative, set the current directory of the runtime),
whilst avoiding build failures on Windows.