bonjorno7 / SourceOps

A more convenient alternative to Blender Source Tools.
GNU General Public License v3.0
138 stars 14 forks source link

Use PurePosixPath instead of Path for model name #70

Closed McGravel closed 2 years ago

McGravel commented 2 years ago

Thanks Xbmann for accidentally coming across this error!

This should fix the UnicodeDecode exception if the user had \x in their model's path.

I don't know if PurePosixPath should be used elsewhere to fix any other backslashes, so I suppose this could be considered a hotfix of sorts.

I'm presuming this is only an issue on Windows since it likes to use backslashes in paths, unsure if functionality is affected on other platforms by this change.

If this fixes the error, then it may be worth considering what other paths should be changed to PurePosixPath

Example error given: image

McGravel commented 2 years ago

the PurePosixPath does change the model's backslash to a forward one, so at least it matches the UI more...

However, the error still occurs; debugging seems to indicate that Popen makes the path with backslashes, even though the args variable appears to use forward ones as input?

image

https://github.com/bonjorno7/SourceOps/blob/bbc8838ca4a22df424b69d4816c761799d122b4b/addon/types/model_export/model.py#L313

More info on what is happening on Windows: https://docs.python.org/3/library/subprocess.html#converting-argument-sequence

McGravel commented 2 years ago

This issue isn't what I was expecting, so i'll close this for now and consider making an Issue instead.