File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,9 @@ app.whenReady().then(() => {
173173
174174 // New: List mods with parsed metadata
175175 ipcMain . handle ( 'getModsWithMetadata' , ( ) => {
176- const modsFolder = path . join ( __dirname , '.minecraft' , 'mods' ) ;
177- if ( ! fs . existsSync ( path . join ( __dirname , '.minecraft' ) ) ) if ( ! fs . existsSync ( modsFolder ) ) fs . mkdirSync ( modsFolder ) ;
176+ try {
177+ const modsFolder = path . join ( __dirname , '.minecraft' , 'mods' ) ;
178+ if ( ! fs . existsSync ( path . join ( __dirname , '.minecraft' ) ) ) if ( ! fs . existsSync ( modsFolder ) ) fs . mkdirSync ( modsFolder , { recursive : true } ) ;
178179
179180 return fs . readdirSync ( modsFolder )
180181 . filter ( f => f . endsWith ( '.jar' ) || f . endsWith ( '.zip' ) )
@@ -183,6 +184,11 @@ app.whenReady().then(() => {
183184 const metadata = getModMetadata ( fullPath ) ;
184185 return { path : fullPath , metadata } ;
185186 } ) ;
187+ } catch ( error ) {
188+ console . error ( 'Error reading mods folder:' , error ) ;
189+ fs . mkdirSync ( path . join ( __dirname , '.minecraft' , 'mods' ) , { recursive : true } ) ;
190+ return [ ] ;
191+ }
186192 } ) ;
187193
188194 ipcMain . on ( 'deleteFromModsFolder' , ( event , path ) => {
You can’t perform that action at this time.
0 commit comments