88import org .mcphackers .mcp .tools .VersionsParser ;
99
1010import java .io .IOException ;
11+ import java .net .URISyntaxException ;
1112import java .nio .file .Files ;
1213import java .nio .file .Paths ;
1314import java .util .*;
1415
1516public class MCP {
1617
17- public static final String VERSION = "v0.1 " ;
18+ public static final String VERSION = "Test " ;
1819 public static EnumMode mode = null ;
1920 public static EnumMode helpCommand = null ;
2021 public static MCPLogger logger ;
@@ -30,24 +31,31 @@ public class MCP {
3031 .fgCyan ().a (" |_| \\ _\\ ___|\\ __|_| \\ ___/" ).fgYellow ().a ("|_| |_|\\ _____|_| " ).a ('\n' )
3132 .fgDefault ();
3233
33- private static boolean checkIfUpdating (String [] args ) throws IOException {
34- if (args .length == 2 ) {
34+ private static boolean checkIfUpdating (String [] args ) throws URISyntaxException , IOException {
35+ System .out .println (Paths .get (MCP .class
36+ .getProtectionDomain ()
37+ .getCodeSource ()
38+ .getLocation ()
39+ .toURI ()));
40+ if (args .length >= 2 ) {
3541 if (args [0 ].equals ("update" )) {
42+ Files .deleteIfExists (Paths .get (args [1 ]));
43+ Files .copy (Paths .get (MCPConfig .UPDATE_JAR ), Paths .get (args [1 ]));
3644 Util .runCommand (new String [] {
3745 Util .getJava (),
3846 "-jar" ,
3947 args [1 ]
4048 });
41- return true ;
4249 }
50+ return true ;
4351 }
4452 return false ;
4553 }
4654
4755 public static void main (String [] args ) throws Exception {
48- if (checkIfUpdating (args )) return ;
49- Files .deleteIfExists (Paths .get (MCPConfig .UPDATE_JAR ));
5056 SelfCommandPrompt .runWithCMD (SelfCommandPrompt .suggestAppId (), "RetroMCP " + VERSION , args );
57+ if (checkIfUpdating (args )) System .exit (0 );
58+ //Files.deleteIfExists(Paths.get(MCPConfig.UPDATE_JAR));
5159 AnsiConsole .systemInstall ();
5260 logger = new MCPLogger ();
5361 config = new MCPConfig ();
0 commit comments