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

Commit ef8417e

Browse files
authored
Merge pull request #11 from noxygalaxy/main
fix: Steam path not found
2 parents 6cb6a0f + fdc6d74 commit ef8417e

File tree

5 files changed

+92
-9
lines changed

5 files changed

+92
-9
lines changed

gui/main.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { app, BrowserWindow, ipcMain } = require('electron');
1+
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
22
const path = require('path');
33
const fs = require('fs');
44
const https = require('https');
@@ -26,6 +26,24 @@ function createWindow() {
2626

2727
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
2828

29+
ipcMain.handle('select-steam-path', async () => {
30+
const result = await dialog.showOpenDialog({
31+
properties: ['openDirectory'],
32+
title: 'Select Steam Installation Directory'
33+
});
34+
35+
if (!result.canceled) {
36+
const selectedPath = result.filePaths[0];
37+
const steamExePath = path.join(selectedPath, 'steam.exe');
38+
if (fs.existsSync(steamExePath)) {
39+
return { success: true, path: selectedPath };
40+
} else {
41+
return { success: false, error: 'Invalid Steam directory. Please select the valid Steam directory.' };
42+
}
43+
}
44+
return { success: false, error: 'Selection cancelled' };
45+
});
46+
2947
ipcMain.on('start-installation', async (event, data) => {
3048
const appData = process.env.APPDATA;
3149

@@ -125,8 +143,8 @@ ipcMain.on('start-installation', async (event, data) => {
125143
} else if (data.theme === 'SteamTheme') {
126144
await delay(1000);
127145

128-
const skinsFolder = 'C:\\Program Files (x86)\\Steam\\steamui\\skins';
129-
const destinationFolder = path.join(skinsFolder, 'SpaceTheme for Steam');
146+
const skinsFolder = path.join(data.steamPath, 'steamui', 'skins');
147+
const destinationFolder = path.join(skinsFolder, 'SpaceTheme For Steam');
130148
const tempPath = path.join(process.env.TEMP, 'SpaceTheme_for_Steam.zip');
131149
const extractedFolderPath = path.join(skinsFolder, 'Steam-main');
132150

@@ -169,7 +187,7 @@ ipcMain.on('start-installation', async (event, data) => {
169187
}
170188

171189
if (!fs.existsSync(skinsFolder)) {
172-
sendLog('Steam skins folder not found. Please install Steam first.');
190+
sendLog('Steam skins folder not found. Please install Millennium/Steam first.');
173191
return;
174192
}
175193

gui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "spacetheme-installer",
33
"private": true,
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"main": "main.js",
66
"scripts": {
77
"start": "electron .",

gui/src/select-theme.html

+37-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<div class="dropdown-item" id="steam-theme">SteamTheme</div>
3434
</div>
3535
</div>
36+
<div class="steam-path-selector" style="display: none;">
37+
<input id="steam-path-display" placeholder="" disabled></input>
38+
<button class="select-steam-path-button">Select Steam Path</button>
39+
</div>
3640

3741
<div class="popup" id="popup">You didn't select the theme.</div>
3842

@@ -127,6 +131,10 @@
127131
const installText = document.querySelector('#install-theme .theme-text');
128132
const resetText = document.querySelector('#reset-theme .theme-text');
129133
const uninstallText = document.querySelector('#uninstall-theme .theme-text');
134+
const steamPathSelector = document.querySelector('.steam-path-selector');
135+
const selectSteamPathButton = document.querySelector('.select-steam-path-button');
136+
const steamPathDisplay = document.getElementById('steam-path-display');
137+
let selectedSteamPath = null;
130138

131139
themeSelector.addEventListener('click', (e) => {
132140
if (e.target.closest('.dropdown-item')) {
@@ -146,11 +154,32 @@
146154
resetText.textContent = `Reset ${selectedTheme}`;
147155
uninstallText.textContent = `Uninstall ${selectedTheme}`;
148156

157+
steamPathSelector.style.display = selectedTheme === 'SteamTheme' ? 'flex' : 'none';
158+
149159
dropdownMenu.classList.remove('active');
150160
themeSelector.classList.remove('active');
151161
});
152162
});
153163

164+
selectSteamPathButton.addEventListener('click', async () => {
165+
try {
166+
const result = await ipcRenderer.invoke('select-steam-path');
167+
if (result.success) {
168+
selectedSteamPath = result.path;
169+
steamPathDisplay.placeholder = `${result.path}`;
170+
if (selectedOption) {
171+
nextButton.classList.add('available');
172+
}
173+
} else {
174+
steamPathDisplay.placeholder = 'Error selecting Steam path';
175+
}
176+
} catch (error) {
177+
steamPathDisplay.placeholder = 'Error selecting Steam path';
178+
selectedSteamPath = null;
179+
nextButton.classList.remove('available');
180+
}
181+
});
182+
154183
const themeOptions = document.querySelectorAll('.theme-option');
155184
const popup = document.getElementById('popup');
156185
let selectedOption = null;
@@ -176,7 +205,12 @@
176205
option.classList.add('active');
177206
selectedOption = option.id;
178207
selectedTheme = currentTheme;
179-
nextButton.classList.add('available');
208+
209+
if (currentTheme === 'SteamTheme' && selectedSteamPath) {
210+
nextButton.classList.add('available');
211+
} else if (currentTheme !== 'SteamTheme') {
212+
nextButton.classList.add('available');
213+
}
180214
});
181215
});
182216

@@ -187,7 +221,8 @@
187221

188222
ipcRenderer.send('start-installation', {
189223
option: selectedOption,
190-
theme: selectedTheme
224+
theme: selectedTheme,
225+
steamPath: selectedSteamPath
191226
});
192227
window.location.href = 'logs.html';
193228
});

gui/src/style.css

+31-1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,36 @@ body {
334334
}
335335

336336

337+
.steam-path-selector {
338+
gap: 6px;
339+
justify-content: space-between;
340+
margin: -6px 0 0;
341+
}
342+
343+
#steam-path-display {
344+
width: 100%;
345+
padding: 0 12px;
346+
font-weight: 600;
347+
border: 2px solid rgb(60, 58, 61);
348+
border-radius: 8px;
349+
background-color: rgb(30, 30, 30);
350+
}
351+
352+
.select-steam-path-button {
353+
white-space: nowrap;
354+
padding: 6px 12px;
355+
border: 2px solid rgb(60, 58, 61);
356+
border-radius: 8px;
357+
color: #fff;
358+
background-color: rgb(30, 30, 30);
359+
cursor: pointer;
360+
}
361+
362+
.select-steam-path-button:hover {
363+
background-color: rgb(40, 40, 40);
364+
}
365+
366+
337367

338368
.installation-header {
339369
display: flex;
@@ -494,4 +524,4 @@ body {
494524
.nav-button.next.available {
495525
cursor: pointer;
496526
opacity: 1;
497-
}
527+
}

gui/src/version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const version = 'v1.0.1';
1+
const version = 'v1.0.2';
22
document.getElementById('version-number').textContent = version;

0 commit comments

Comments
 (0)