File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- try {
2- const nbin = require ( "nbin" ) ;
3- const path = require ( "path" ) ;
4- const rootPath = path . resolve ( __dirname , "../../.." ) ;
5- console . log ( "Shimming" , rootPath ) ;
6- nbin . shimNativeFs ( rootPath ) ;
7- } catch ( error ) {
8- console . log ( "Not in the binary" ) ;
9- }
10-
111require ( "../../bootstrap-amd" ) . load ( "vs/server/cli" ) ;
Original file line number Diff line number Diff line change 1+ if ( ! global . NBIN_LOADED ) {
2+ try {
3+ const nbin = require ( "nbin" ) ;
4+ nbin . shimNativeFs ( "{{ROOT_PATH}}" ) ;
5+ global . NBIN_LOADED = true ;
6+ } catch ( error ) {
7+ console . log ( "Not in the binary" ) ;
8+ }
9+ }
Original file line number Diff line number Diff line change @@ -41,6 +41,18 @@ function copy-server() {
4141 fi
4242}
4343
44+ # Prepend the nbin loading code which allows the code to find files within
45+ # the binary.
46+ function prepend-loader() {
47+ local filePath=" ${codeServerBuildPath} /${1} " ; shift
48+ cat " ${rootPath} /scripts/nbin-loader.js" " ${filePath} " > " ${filePath} .temp"
49+ mv " ${filePath} .temp" " ${filePath} "
50+ # Using : as the delimiter so the escaping here is easier to read.
51+ # ${parameter/pattern/string}, so the pattern is /: (if the pattern starts
52+ # with / it matches all instances) and the string is \\: (results in \:).
53+ sed -i " s:{{ROOT_PATH}}:${codeServerBuildPath//:/ \\ : } :g" " ${filePath} "
54+ }
55+
4456# Copy code-server into VS Code then build it.
4557function build-code-server() {
4658 copy-server
@@ -62,6 +74,9 @@ function build-code-server() {
6274 rm -rf " ${codeServerBuildPath} /out/vs/server/node_modules"
6375 cp -r " ${vscodeSourcePath} /remote/node_modules" " ${codeServerBuildPath} "
6476
77+ prepend-loader " out/vs/server/main.js"
78+ prepend-loader " out/bootstrap-fork.js"
79+
6580 log " Final build: ${codeServerBuildPath} "
6681}
6782
You can’t perform that action at this time.
0 commit comments