MovingBlocks / box2d-editor

Automatically exported from code.google.com/p/box2d-editor - migrated here to maybe maintain together with Destination Sol. Original website:
https://code.google.com/archive/p/box2d-editor/
Apache License 2.0
84 stars 21 forks source link

Assets don't load properly from saved files #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set output file to existing file

What is the expected output? What do you see instead?
Assets should load from saved file. Instead, assets are populated with [NOT 
FOUND] prepended.

What version of the product are you using? On what operating system?
1.1 on OS X Lion

Please provide any additional information below.

Original issue reported on code.google.com by kensuke...@gmail.com on 8 Sep 2011 at 4:28

GoogleCodeExporter commented 9 years ago
Is it an issue with the included test file only? Or does this issue happen also 
with your own saved files?

With the test file, it is a known behavior since it was saved on windows in OS 
X seems to not accept "\" file separator in a path, unlike linux and windows.

Anyway, the next revision of the tool will be platform independant for the 
paths and will support "\" and "/", so a file saved on Windows will work on OS 
X and vice-versa.

Original comment by aurelien.ribon on 9 Sep 2011 at 7:33

GoogleCodeExporter commented 9 years ago
It's a problem with the included test file, and my own saved file.

Original comment by kensuke...@gmail.com on 14 Sep 2011 at 8:50

GoogleCodeExporter commented 9 years ago
Actually, after looking at the source, now I'm not sure about my last statement.

The bug is on line 69 of IO.java:

String name = is.readUTF();

Should be:

String name = FileUtils.convertSystemPath(is.readUTF(), File.separator);

Where the method I added is:

public static String convertSystemPath(String path, String pathSeparator) {
    if (pathSeparator.equals("/")) {
        return FilenameUtils.separatorsToUnix(path);
    }
    else if (pathSeparator.equals("\\")) {
        return FilenameUtils.separatorsToWindows(path);
    }
    else {
        throw new IllegalArgumentException("Unrecognised dir separator '" + pathSeparator + "'");
    }
}

Original comment by kensuke...@gmail.com on 15 Sep 2011 at 7:32

GoogleCodeExporter commented 9 years ago
Thanks, that's what I included to make the next revision system-independent. I 
was absent for a week but will fix these errors ASAP now.

Original comment by aurelien.ribon on 16 Sep 2011 at 8:27

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 90414bcc76d9.

Original comment by aurelien.ribon on 28 Sep 2011 at 8:58