HearthSim / UnityPack

Python deserialization library for Unity3D Asset format
https://hearthsim.info/
MIT License
720 stars 153 forks source link

path.os.abspath returning the wrong path #73

Open Aedial opened 6 years ago

Aedial commented 6 years ago

At the line 61 of unityextract : def get_output_path(self, filename): basedir = os.path.abspath(self.args.outdir) path = os.path.join(basedir, filename) dirs = os.path.dirname(path)

The os.path.abspath change the self.arg.outdir to an incorrect path. The tests I ran gave me this : outdir : D:\\Personnel\\Jeux\\Chain Strike\\Extractor\\res\\shaders basedir : D:\\Personnel\\Jeux\\Chain Strike\\Utility\\ D:\\Personnel\\Jeux\\Chain Strike\\Extractor\\res\\shaders path : D:\\Personnel\\Jeux\\Chain Strike\\Utility\\ D:\\Personnel\\Jeux\\Chain Strike\\Extractor\\res\\shaders\\Unlit - Transparent Colored.cg dirs : D:\\Personnel\\Jeux\\Chain Strike\\Utility\\ D:\\Personnel\\Jeux\\Chain Strike\\Extractor\\res\\shaders

The os.path.abspath concatenated the cwd of the file I was running with the correct path. It was messing with the makedirs and returning an error each time (OSError: [WinError 123]). It's not hard to fix, but quite annoying to find without an accurate debugging.

Edit : I forgot to say that I used subprocess.call / subprocess.Popen to call the command. It works fine with the command-line tool. Other weird behavior : using "-o path" in the command raise the error, but using "-opath" works just fine.