Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 79538e7

Browse files
committed
finish extraction feature
1 parent 40c5d55 commit 79538e7

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ Make sure you [follow the wiki's directions](https://wiki.garrysmod.com/page/Wor
1616
Settings are saved at `%APPDATA%/gmod-addon-tool`, delete this folder to reset any settings created.
1717

1818
Otherwise,
19-
[create an issue](https://github.com/Leeous/gmod-addon-tool/issues/new) or send me a tweet/DM [@LeeTheCoder](https://twitter.com/LeeTheCoder).
19+
[create an issue](https://github.com/Leeous/gmod-addon-tool/issues/new) or send me a tweet/DM.
20+
21+
### Social
22+
[Trello](https://trello.com/b/nKkmOv2U)
23+
[@LeeTheCoder](https://twitter.com/LeeTheCoder)
24+
[Website](https://leeous.com)

app.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ const settings = require('electron-settings');
1212
// be closed automatically when the JavaScript object is garbage collected.
1313
let mainWindow
1414

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');
2216

2317
function createWindow() {
2418
// Create the browser window.
@@ -71,12 +65,14 @@ app.on('activate', function() {
7165
// In this file you can include the rest of your app's specific main process
7266
// code. You can also put them in separate files and require them here.
7367

68+
// Checks to see if the directory the user chooses is writeable
7469
ipcMain.on('checkIfDirectoryExists', (event, file) => {
7570
fs.access(file, fs.constants.R_OK, (err) => {
7671
console.log(`${file} ${err ? 'is not readable' : 'is readable'}`);
7772
});
7873
})
7974

75+
// This will send the client the IDs of their addons
8076
ipcMain.on('getAddonInfo', () => {
8177
console.log('Trying to get addon info...');
8278
sendClientAddonInfo();
@@ -86,7 +82,6 @@ ipcMain.on('getAddonInfo', () => {
8682
var ADDON_IDS = [];
8783

8884
// We use this to get the addon IDs from gmpublish.exe
89-
9085
function sendClientAddonInfo() {
9186
const bat = spawn(settings.get('gmodDirectory') + '\\bin\\gmpublish.exe', ['list']);
9287
bat.stdout.on('data', (data) => {
@@ -105,6 +100,7 @@ function sendClientAddonInfo() {
105100
});
106101
}
107102

103+
// This creates our addon.json
108104
ipcMain.on('createJsonFile', (event, json, dir) => {
109105
console.log(json, dir)
110106
fs.writeFileSync(dir + "\\addon.json", json, 'utf8', (err) => {
@@ -156,11 +152,10 @@ ipcMain.on('uploadToWorkshop', (event, gmaDir, iconDir, addonId) => {
156152
};
157153
});
158154

155+
// This will extract a GMA file to GarrysMod/garrysmod/addons/[addon_name]
159156
ipcMain.on("extractAddon", (e, path) => {
160157
console.log(e, path);
161158
const gmad = spawn(settings.get('gmodDirectory') + '\\bin\\gmad.exe', ['extract', '-file', path]);
162159
mainWindow.webContents.send("finishExtraction");
163160
// shell.openItem('folderpath')
164161
});
165-
166-
// gmpublish.exe create -icon path/to/image512x512.jpg -addon path/to/gma.gma

src/js/script.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ $(document).ready(() => {
245245
});
246246
});
247247

248+
$("#extractedGMALocation").click(() => {
249+
console.log(addonPath.substring(0, addonPath.length - 4) + "\\")
250+
shell.openItem(addonPath.substring(0, addonPath.length - 4));
251+
})
252+
248253
// If directory exists (and is writable/readable) allow user to procede
249254
$('#addon_dir_folder').click(() => {
250255
dialog.showOpenDialog(win, dirDialogOptions).then(result => {

0 commit comments

Comments
 (0)