From 2be5287acac936a7ce44fe894a1c7feb10de0734 Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 31 Dec 2024 12:16:47 -0600 Subject: [PATCH] Create the mods folder if it's missing --- src/main/java/net/vhati/modmanager/FTLModManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/vhati/modmanager/FTLModManager.java b/src/main/java/net/vhati/modmanager/FTLModManager.java index b4fa76b..aefd1e9 100644 --- a/src/main/java/net/vhati/modmanager/FTLModManager.java +++ b/src/main/java/net/vhati/modmanager/FTLModManager.java @@ -100,12 +100,18 @@ private static void guiInit() { try { // Nag if the jar was double-clicked. if ( new File( "./mods/" ).exists() == false ) { + // Check if the mods folder is just missing for some reason ( also check unix ) + if ( new File( "./modman.exe" ) .exists() == true || new File( "./modman-cli.sh" ) .exists() == true ) { + log.warn( "Mods folder gone! Trying to create a new one..." ); + new File( "./mods/" ) .mkdirs(); + } else { String currentPath = new File( "." ).getAbsoluteFile().getParentFile().getAbsolutePath(); log.error( String.format( "Slipstream could not find its own folder (Currently in \"%s\"), exiting...", currentPath ) ); showErrorDialog( String.format( "Slipstream could not find its own folder.\nCurrently in: %s\n\nRun one of the following instead of the jar...\nWindows: modman.exe or modman_admin.exe\nLinux/OSX: modman.command or modman-cli.sh\n\nSlipstream will now exit.", currentPath ) ); throw new ExitException(); + } } File configFile = new File( "modman.cfg" );