Misc cleanup / documentation

This commit is contained in:
hensm
2018-11-28 07:56:29 +00:00
parent f8f997db76
commit 5ee6b25cb7
2 changed files with 10 additions and 7 deletions

View File

@@ -2,9 +2,7 @@ const fs = require("fs-extra");
const os = require("os"); const os = require("os");
const path = require("path"); const path = require("path");
const { executableName const { manifestName
, executablePath
, manifestName
, manifestPath , manifestPath
, DIST_DIR_PATH } = require("./lib/paths"); , DIST_DIR_PATH } = require("./lib/paths");
@@ -16,15 +14,17 @@ const WIN_REGISTRY_KEY = "fx_cast_bridge";
if (!fs.existsSync(CURRENT_MANIFEST_PATH) && !argv.remove) { if (!fs.existsSync(CURRENT_MANIFEST_PATH) && !argv.remove) {
console.error("No manifest in dist/app/ to install"); console.error("No manifest in dist/app/ to install.");
process.exit(1); process.exit(1);
} }
const platform = os.platform(); const platform = os.platform();
switch (platform) { switch (platform) {
case "darwin": case "darwin":
case "linux": { case "linux": {
// Manifest location within home directory
const destination = path.join(os.homedir(), manifestPath[platform]); const destination = path.join(os.homedir(), manifestPath[platform]);
if (argv.remove) { if (argv.remove) {
@@ -32,6 +32,7 @@ switch (platform) {
break; break;
} }
// Install manifest
fs.ensureDirSync(destination); fs.ensureDirSync(destination);
fs.copyFileSync(CURRENT_MANIFEST_PATH fs.copyFileSync(CURRENT_MANIFEST_PATH
, path.join(destination, manifestName)); , path.join(destination, manifestName));
@@ -59,7 +60,8 @@ switch (platform) {
break; break;
}; };
default: default: {
console.error("Sorry, this installer does not yet support your OS"); console.error("Sorry, this installer does not yet support your OS");
process.exit(1); process.exit(1);
}
} }

View File

@@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
if [ "$2" != "/" ] # If the target location isn't root, we need to rewrite
then # the manifest path to point to the user directory.
if [ "$2" != "/" ]; then
manifestPath=$2"/Library/Application Support/Mozilla/NativeMessagingHosts/fx_cast_bridge.json" manifestPath=$2"/Library/Application Support/Mozilla/NativeMessagingHosts/fx_cast_bridge.json"
sed -i.bak 's,"path": "/Library,"path": "'$2'/Library,g' "$manifestPath" sed -i.bak 's,"path": "/Library,"path": "'$2'/Library,g' "$manifestPath"
rm "$manifestPath.bak" rm "$manifestPath.bak"