mirror of https://git.tuxpa.in/a/code-server.git
Recursively create modules directory
This commit is contained in:
parent
75c8bd62f1
commit
59eec534b6
|
@ -8,14 +8,19 @@ declare var __non_webpack_require__: typeof require;
|
||||||
* Handling of native modules within the CLI
|
* Handling of native modules within the CLI
|
||||||
*/
|
*/
|
||||||
export const setup = (dataDirectory: string): void => {
|
export const setup = (dataDirectory: string): void => {
|
||||||
|
path.resolve(dataDirectory, "modules").split(path.sep).reduce((parentDir, childDir) => {
|
||||||
|
const currentDir = path.join(parentDir, childDir);
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(path.join(dataDirectory, "modules"));
|
fs.mkdirSync(currentDir);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.code !== "EEXIST") {
|
if (ex.code !== "EEXIST") {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return currentDir;
|
||||||
|
}, path.sep);
|
||||||
|
|
||||||
const unpackModule = (moduleName: string): void => {
|
const unpackModule = (moduleName: string): void => {
|
||||||
const memFile = path.join(isCli ? buildDir! : path.join(__dirname, ".."), "build/modules", moduleName + ".node");
|
const memFile = path.join(isCli ? buildDir! : path.join(__dirname, ".."), "build/modules", moduleName + ".node");
|
||||||
const diskFile = path.join(dataDirectory, "modules", moduleName + ".node");
|
const diskFile = path.join(dataDirectory, "modules", moduleName + ".node");
|
||||||
|
|
Loading…
Reference in New Issue