Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 220 forks source link

Decompiler outputs files with weird path on OSX #27

Closed Morgon closed 10 years ago

Morgon commented 10 years ago

Hello! Thank you for your work on this; this has been quite an interesting learning tool, and seems to handle some of those 'monitorenter' calls a bit more than other tools.

In any case, each time I use the decompile.py program, it saves my target file in a peculiar way:

$ python Krakatau/decompile.py \
  -path android-sdk-macosx/platforms/android-19/android.jar \
  -path com.package.name_dex2jar.jar \
  com.package.name.target.Class

[snip]

Class written to \\?\/Users/morgon/Downloads\com\package\name\target\Class.java

Note the initial escaped slashes, and the change in slashes. Running this from my 'Downloads' folder, it has created this literal structure:

$ tree \\\\\?\\/
\\\\?\\/
└── Users
    └── morgon
        └── Downloads\\com\\package\\name\\target\\Class.java

This is coming from a fresh clone of the code (02cd99c76c).

Using the -out flag just replaces 'Downloads' in the filename to whatever string I provide, regardless of whether it's an existing directory.

It's not a huge issue, but it does make viewing the results a bit unwieldy. Thanks again!

Storyyeller commented 10 years ago

Oh, it appears that the OS detection is broken. This should only happen under Windows. I'm guessing that platform.system() is returning some variation on "darwin" and the "win" substring makes it think it's Windows.

Unfortunately, Os specific behavior is something that I can't easily test due to the lack of computers with different OSes.

Storyyeller commented 10 years ago

Anyway, it should hopefully be fixed now. Tell me if that didn't work.

Morgon commented 10 years ago

Was just about to respond to say it was simply "darwin" (no other text). Your change does make things work as expected. Thank you!