Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent Files from CMD Line #225

Closed
RobertBColton opened this issue Sep 14, 2015 · 1 comment
Closed

Recent Files from CMD Line #225

RobertBColton opened this issue Sep 14, 2015 · 1 comment

Comments

@RobertBColton
Copy link
Collaborator

RobertBColton commented Sep 14, 2015

The old LateralGM versions below 1.8.2 had a bug with CMD line arguments. The CMD line argument for which file to open was not being properly parsed into a URI, I believe that I had resolved this.
We can see the old code and the new code:

Listener.getInstance().fc.open(new URI(args[0]));

        if (args.length != 0)
            {
            splashProgress.progress(95,Messages.getString("LGM.SPLASH_PRELOAD")); //$NON-NLS-1$
            try
                {
                Listener.getInstance().fc.open(new URI(args[0]));
                }
            catch (URISyntaxException e)
                {
                e.printStackTrace();
                }
            }
        // Load any projects entered on the command line
        if (args.length > 0 && args[0].length() > 1)
            {
            URI uri = new File(args[0]).toURI();
            Listener.getInstance().fc.open(uri);
            }
        else
            {
            LOADING_PROJECT = false;
            }

I also tried as hard as I could to reproduce this with the newer LGM's and I just couldn't. You can see below that I can reproduce it instantly with lgm16b4 but not 1.8.2 or any of the newest versions.

C:\Users\Owner\Desktop>java -jar lateralgm.jar "C:\Users\Owner\Documents\Game Pr
oject\shotgun_funfun_online_gm81.gmk"
Error: Unable to access jarfile lateralgm.jar

C:\Users\Owner\Desktop>java -jar lateralgm182.jar "C:\Users\Owner\Documents\Game
 Project\shotgun_funfun_online_gm81.gmk"
Sep 15, 2015 4:45:58 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Java Version: 10800 (1.8.0_60)
Loading lib files in C:\Users\Owner\Desktop\lateralgm182.jar
01_move.lgl 02_main1.lgl 03_main2.lgl 04_control.lgl
 05_score.lgl 06_extra.lgl 07_draw.lgl
time taken to load file: 382 ms

C:\Users\Owner\Desktop>java -jar lateralgm16b4.jar "C:\Users\Owner\Documents\Gam
e Project\shotgun_funfun_online_gm81.gmk"
Java Version: 10800 (1.8.0_60)
Sep 15, 2015 4:46:37 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Loading lib files in C:\Users\Owner\Desktop\lateralgm16b4.jar
01_move.lgl 02_main1.lgl 03_main2.lgl 04_control.lgl
 05_score.lgl 06_extra.lgl 07_draw.lgl
java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\Use
rs\Owner\Documents\Game Project\shotgun_funfun_online_gm81.gmk
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.checkChars(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        at org.lateralgm.main.LGM.main(LGM.java:490)
time taken to load file: 396 ms

C:\Users\Owner\Desktop>

I also emulated the file path he was loading on ENIGMA forums when he got the exception and was able to do it fine with LGM from the command line. I also tested the latest enigma.exe to make sure it was passing it ok and it seems to be fine there too. So I am convinced this was caused by the user having an old LGM version and then upgrading to a newer one, but they did not indicate. Loading a similar path with spaces from the CMD line works absolutely fine for me with the newest LGM.

@RobertBColton
Copy link
Collaborator Author

Closing as duplicate of #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant