-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrenderer.js
72 lines (64 loc) · 1.9 KB
/
renderer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// No Node.js APIs are available in this process because
// `nodeIntegration` is turned off. Use `preload.js` to
// selectively enable features needed in the rendering
// process.
// Dans le processus de rendu (page web).
const { ipcRenderer } = require('electron')
const fs = require('fs-extra')
let username = require("os").userInfo().username
const openExplorer = require('open-file-explorer');
function openBackupDir(){
const path = 'C:\\TekkenSaveBackup';
openExplorer(path, err => {
if(err) {
console.log(err);
snack(err);
}
else {
//Do Something
}
});
}
function openTekkenDir(){
const path = 'C:\\Users\\'+username+'\\AppData\\Local\\TekkenGame\\Saved\\SaveGames\\TEKKEN7';
openExplorer(path, err => {
if(err) {
console.log(err);
snack(err);
}
else {
//Do Something
}
});
}
function backupSave(){
try {
fs.copySync('/Users/'+username+'/AppData/Local/TekkenGame/Saved/SaveGames/TEKKEN7/', '/TekkenSaveBackup')
console.log('Success!')
snack('Success!')
} catch (err) {
console.error(err)
snack(err)
}
}
function importSave() {
try {
fs.copySync( '/TekkenSaveBackup', '/Users/'+username+'/AppData/Local/TekkenGame/Saved/SaveGames/TEKKEN7/')
console.log('Success!')
snack('Success!')
} catch (err) {
console.error(err)
snack(err)
}
}
function snack(msg) {
// Get the snackbar DIV
let x = document.getElementById("snackbar");
x.innerText = msg
// Add the "show" class to DIV
x.className = "show";
// After 3 seconds, remove the show class from DIV
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}