File size: 979 Bytes
8f3f8db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * This plugin is only here for retrieving the current working directory (for finding .changes and .sources files)
 */

function UnixOSProcessPlugin() {
  "use strict";

  return {
    getModuleName: function() { return 'UnixOSProcessPlugin'; },
    interpreterProxy: null,
    primHandler: null,

    setInterpreter: function(anInterpreter) {
      this.interpreterProxy = anInterpreter;
      this.primHandler = this.interpreterProxy.vm.primHandler;
      return true;
    },

    primitiveGetCurrentWorkingDirectory: function(argCount) {
      this.interpreterProxy.popthenPush(argCount + 1, this.primHandler.makeStString(require("process").cwd()));
      return true;
    },
  };
}

function registerUnixOSProcessPlugin() {
    if (typeof Squeak === "object" && Squeak.registerExternalModule) {
        Squeak.registerExternalModule('UnixOSProcessPlugin', UnixOSProcessPlugin());
    } else setTimeout(registerUnixOSProcessPlugin, 100);
};

registerUnixOSProcessPlugin();