@@ -12,13 +12,7 @@ const settings = require('electron-settings');
12
12
// be closed automatically when the JavaScript object is garbage collected.
13
13
let mainWindow
14
14
15
- console . log ( '\n' )
16
-
17
- // settings.deleteAll();
18
-
19
- // exec("gmad.exe", [], {cwd: 'E:\\SteamLibrary\\steamapps\\common\\GarrysMod\\bin\\gmad.exe', shell: true}, function callback(error, stdout, stderr) {
20
- // console.log("started console app", stdout, stderr, error);
21
- // });
15
+ console . log ( '\n' ) ;
22
16
23
17
function createWindow ( ) {
24
18
// Create the browser window.
@@ -71,12 +65,14 @@ app.on('activate', function() {
71
65
// In this file you can include the rest of your app's specific main process
72
66
// code. You can also put them in separate files and require them here.
73
67
68
+ // Checks to see if the directory the user chooses is writeable
74
69
ipcMain . on ( 'checkIfDirectoryExists' , ( event , file ) => {
75
70
fs . access ( file , fs . constants . R_OK , ( err ) => {
76
71
console . log ( `${ file } ${ err ? 'is not readable' : 'is readable' } ` ) ;
77
72
} ) ;
78
73
} )
79
74
75
+ // This will send the client the IDs of their addons
80
76
ipcMain . on ( 'getAddonInfo' , ( ) => {
81
77
console . log ( 'Trying to get addon info...' ) ;
82
78
sendClientAddonInfo ( ) ;
@@ -86,7 +82,6 @@ ipcMain.on('getAddonInfo', () => {
86
82
var ADDON_IDS = [ ] ;
87
83
88
84
// We use this to get the addon IDs from gmpublish.exe
89
-
90
85
function sendClientAddonInfo ( ) {
91
86
const bat = spawn ( settings . get ( 'gmodDirectory' ) + '\\bin\\gmpublish.exe' , [ 'list' ] ) ;
92
87
bat . stdout . on ( 'data' , ( data ) => {
@@ -105,6 +100,7 @@ function sendClientAddonInfo() {
105
100
} ) ;
106
101
}
107
102
103
+ // This creates our addon.json
108
104
ipcMain . on ( 'createJsonFile' , ( event , json , dir ) => {
109
105
console . log ( json , dir )
110
106
fs . writeFileSync ( dir + "\\addon.json" , json , 'utf8' , ( err ) => {
@@ -156,11 +152,10 @@ ipcMain.on('uploadToWorkshop', (event, gmaDir, iconDir, addonId) => {
156
152
} ;
157
153
} ) ;
158
154
155
+ // This will extract a GMA file to GarrysMod/garrysmod/addons/[addon_name]
159
156
ipcMain . on ( "extractAddon" , ( e , path ) => {
160
157
console . log ( e , path ) ;
161
158
const gmad = spawn ( settings . get ( 'gmodDirectory' ) + '\\bin\\gmad.exe' , [ 'extract' , '-file' , path ] ) ;
162
159
mainWindow . webContents . send ( "finishExtraction" ) ;
163
160
// shell.openItem('folderpath')
164
161
} ) ;
165
-
166
- // gmpublish.exe create -icon path/to/image512x512.jpg -addon path/to/gma.gma
0 commit comments