@shockpkg/dir-projector
Version:
Package for creating Shockwave Director projectors
53 lines (44 loc) • 1.23 kB
JavaScript
import { join as pathJoin, basename } from 'path';
import fse from 'fs-extra';
import { trimExtension } from "../../util.mjs";
import { windowsLauncher } from "../../util/windows.mjs";
import { ProjectorWindows32 } from "../../projector/windows/32.mjs";
import { BundleWindows } from "../windows.mjs";
/**
* BundleWindows32 constructor.
*
* @param path Output path for the main application.
*/
export class BundleWindows32 extends BundleWindows {
/**
* ProjectorWindows32 instance.
*/
constructor(path) {
super(path);
this.projector = void 0;
this.projector = this._createProjector();
}
/**
* Create projector instance for the bundle.
*
* @returns Projector instance.
*/
_createProjector() {
const {
path,
extension
} = this;
const directory = trimExtension(path, extension, true);
if (directory === path) {
throw new Error(`Output path must end with: ${extension}`);
}
return new ProjectorWindows32(pathJoin(directory, basename(path)));
}
/**
* Write the launcher file.
*/
async _writeLauncher() {
await fse.outputFile(this.path, await windowsLauncher('i686', this.projector.path));
}
}
//# sourceMappingURL=32.mjs.map