diff options
author | Andrew Dolgov <[email protected]> | 2019-03-14 07:58:35 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-03-14 07:58:35 +0300 |
commit | 1838c27cb28ec56954ce2ab6896d125c764cb338 (patch) | |
tree | 49ddceafa7818f5501d6447e2e81f14a34c14846 | |
parent | 3c7b26547a443c54ff51f9e0a1bfa8c2c2214e9b (diff) |
support opening files from command line
-rw-r--r-- | build.sh | 12 | ||||
-rwxr-xr-x | package-lock.json | 2 | ||||
-rwxr-xr-x | package.json | 6 | ||||
-rwxr-xr-x | reader.js | 15 |
4 files changed, 25 insertions, 10 deletions
@@ -1,19 +1,19 @@ #!/bin/sh DIR=$(basename `pwd`) -DIST="tt-comics" +DIST="Pow! Comics Reader" + +npm install cd .. -npm install npm install -g electron-packager -electron-packager $DIR $DIST \ +electron-packager $DIR \ --platform win32 \ --arch x64 \ --icon $DIR/img/favicon.ico \ --overwrite -rm -f $DIST-win32-x64.zip - -zip -r $DIST-win32-x64.zip $DIST-win32-x64 +rm -f "$DIST-win32-x64.zip" +zip -r "$DIST-win32-x64.zip" "$DIST-win32-x64" diff --git a/package-lock.json b/package-lock.json index a8bae51..cd1a04c 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "tt-comics-electron", + "name": "tt-comics", "version": "0.0.1", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index aa45882..e13c87c 100755 --- a/package.json +++ b/package.json @@ -1,8 +1,10 @@ { - "name": "tt-comics-electron", + "name": "tt-comics", + "productName": "Pow! Comics Reader", "version": "0.0.1", - "description": "Pow! Comics Reader (electron)", + "description": "Pow! Comics Reader", "main": "app.js", + "license": "GPL-3.0", "scripts": { "start": "electron ." }, @@ -288,7 +288,7 @@ function Model() { const model = new Model(); $(document).ready(function () { - const { ipcRenderer } = require('electron'); + const { remote, ipcRenderer } = require('electron'); localforage.getItem("TTC:SYNC-ACCOUNT").then((acct) => { if (acct) @@ -481,11 +481,24 @@ $(document).ready(function () { model._mruList.push(e); }); + localforage.getItem("LAST-OPENED-FILE").then((last) => { + const fs = remote.require('fs'); + const argv = remote.process.argv; + + if (argv[1] && argv[1] != ".") { + fs.access(argv[1], fs.constants.R_OK, (err) => { + if (err == null) + return model.openFile(argv[1]); + + }); + } + if (last != null) { model.openFile(last); } }); + }); }); |