xuri / xgen

XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator
BSD 3-Clause "New" or "Revised" License
313 stars 74 forks source link

Unexpected directory creation and wrong filename (extra extension) when using -o to specify a file #56

Closed brianpursley closed 2 years ago

brianpursley commented 2 years ago

Description When running xgen -l Java -i test/xsd/base64.xsd -o output.java, it unexpectedly creats an empty directory called output.java and a filename called output.java.java that has the generated code.

I'm working on a local change and plan to submit a PR shortly which I think will fix this.

Steps to reproduce the issue:

xgen -l Java -i test/xsd/base64.xsd -o output.java

Describe the results you received:

$ ls -la | grep output.java
drwxr-xr-x  2 bpursley bpursley  4096 Jul 20 09:29 output.java
-rw-rw-r--  1 bpursley bpursley  2066 Jul 20 09:29 output.java.java

Describe the results you expected:

$ ls -la | grep output.java
-rw-rw-r--  1 bpursley bpursley  2066 Jul 20 09:29 output.java

Output of go version:

go version go1.18.1 linux/amd64

xgen version or commit ID:

98e2a901798bddb93c5e532c98afc1f5f139d47e

Environment details (OS, physical, etc.):

$ uname -a
Linux cinlogic-xps13 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux