Skip to content

Commit

Permalink
get user home path to create temporary directory works ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
dawalberto committed Feb 28, 2021
1 parent 97ba1e1 commit 53d597d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"electron": "^11.0.0",
"electron": "^11.3.0",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
Expand Down
3 changes: 2 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function createWindow() {
webPreferences: {
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
enableRemoteModule: true
}
})

Expand Down
12 changes: 7 additions & 5 deletions src/views/Union.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
>
<button
v-if="showDownloadButton"
:disabled="downloadButtonDisabled"
@click="showPromptToSelectDirToDownload"
class="bg-yellow-300 py-4 px-6 uppercase tracking-wider font-thin text-4xl"
>
Expand All @@ -39,8 +40,8 @@

<script>
const fs = require('fs')
// const { app } = require('electron')
const zipdir = require('zip-dir')
const electron = require('electron')
import { mapState } from 'vuex'
export default {
Expand All @@ -51,7 +52,6 @@ export default {
mounted() {
setTimeout(() => {
this.joinFiles()
// this.writeFileSync()
}, 0)
},
computed: {
Expand All @@ -74,7 +74,8 @@ export default {
tempDirectoryJjoin: '',
tempDirectoryJjoinManyFiles: '',
directoryToDownload: '',
showDownloadButton: false
showDownloadButton: false,
downloadButtonDisabled: false
}
},
watch: {
Expand All @@ -89,8 +90,7 @@ export default {
},
methods: {
createTmpDirsIfNotExists() {
// let tempDir = `${app.getPath('temp')}`
this.tempDirectory = '/Users/dawalberto/Desktop/tempDev'
this.tempDirectory = (electron.app || electron.remote.app).getPath('home')
this.tempDirectoryJjoin = `${this.tempDirectory}/.jjoin`
this.tempDirectoryJjoinManyFiles = `${this.tempDirectoryJjoin}/jjoinFiles`
Expand Down Expand Up @@ -244,6 +244,7 @@ export default {
}
},
showPromptToSelectDirToDownload() {
this.downloadButtonDisabled = true
document.querySelector('#selectDirToDownload').click()
},
async zipAndDownloadFiles() {
Expand All @@ -256,6 +257,7 @@ export default {
`${this.directoryToDownload}/jjoin.zip`
)
this.deleteTempDirectoryJjoin()
this.downloadButtonDisabled = false
} catch (error) {
console.log('zipAndDownloadFiles', error)
}
Expand Down

0 comments on commit 53d597d

Please sign in to comment.