feat(portable): portable win64 version support #9

This commit is contained in:
Alexey Kasyanchuk
2018-03-10 09:22:36 +03:00
parent 3c0930fcd6
commit 8ae812f18e
2 changed files with 13 additions and 2 deletions

View File

@ -8,7 +8,7 @@
}, },
{ {
"path": "@semantic-release/exec", "path": "@semantic-release/exec",
"cmd": "brew install rpm && brew install dpkg && brew install jq && npm run build -- --linux --win --mac" "cmd": "brew install rpm && brew install dpkg && brew install jq && npm run build -- --linux --win --mac && cd dist/win-unpacked && mkdir data && cd .. && zip -vr rats-search-`node -p \"require('../package.json').version\"`-portable.win.x64.zip win-unpacked/"
}, },
"@semantic-release/github" "@semantic-release/github"
], ],

View File

@ -43,6 +43,15 @@ if (env.name !== "production") {
const userDataPath = app.getPath("userData"); const userDataPath = app.getPath("userData");
app.setPath("userData", `${userDataPath} (${env.name})`); app.setPath("userData", `${userDataPath} (${env.name})`);
} }
// portative version
let portative = false
if(env.name === "production") {
if(fs.existsSync(path.dirname(process.execPath) + `/data`))
{
portative = true;
app.setPath("userData", path.dirname(process.execPath) + `/data`);
}
}
const resourcesPath = env.name === "production" ? process.resourcesPath : 'resources' const resourcesPath = env.name === "production" ? process.resourcesPath : 'resources'
@ -76,6 +85,8 @@ console.log('CPU Logic cores:', os.cpus().length)
console.log('Total memory:', (os.totalmem() / (1024 * 1024)).toFixed(2), 'MB') console.log('Total memory:', (os.totalmem() / (1024 * 1024)).toFixed(2), 'MB')
console.log('Free memory:', (os.freemem() / (1024 * 1024)).toFixed(2), 'MB') console.log('Free memory:', (os.freemem() / (1024 * 1024)).toFixed(2), 'MB')
if(portative)
console.log('portative compability')
const shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { const shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window. // Someone tried to run a second instance, we should focus our window.
@ -325,7 +336,7 @@ app.on("ready", () => {
} }
}) })
if (env.name === "production") { autoUpdater.checkForUpdates() } if (env.name === "production" && !portative) { autoUpdater.checkForUpdates() }
spider = spiderCall((...data) => { spider = spiderCall((...data) => {
if(mainWindow) if(mainWindow)