jonasthewolf / gsn2x

Tool to create graphical representations of Goal Structuring Notations from YAML.
MIT License
27 stars 9 forks source link

Cannot copy stylesheet for project #436

Closed Ilidur closed 3 months ago

Ilidur commented 3 months ago

Describe the bug

I would like to use the stylesheet functionality without embedding (-t). I pass the -s flag and the --output-dir flag and I get an OS error. If I do the same but with the -t the error does not occur and the functionality is present.

To Reproduce

bin/gsn2x gsn.yaml  --output-dir gsn-svg -s style/status.css
Error: Could not copy stylesheet from /$PROJECT/style/status.css to /$PROJECT/gsn-svg
Caused by:
    Is a directory (os error 21)

Expected behavior

The SVGs get generated and the stylesheets get copied into the output folder.

Desktop (please complete the following information):

Additional context

Add any other context about the problem here.

jonasthewolf commented 3 months ago

Thanks for your feedback @Ilidur .

You replaced the real path with $PROJECT for the bug report, right?

Does the path contain spaces?

Ilidur commented 3 months ago

yes, anonymised project with $PROJECT

No spaces but does contain -

Ilidur commented 3 months ago

eliminated all - but still same result. Added additional output in the description.

Ilidur commented 3 months ago

Under Windows PS I get the following

.\bin\gsn2x.exe --stylesheet .\style\status.css .\gsn.yaml --output-dir gsn-svg 
Error: Could not copy stylesheet from \\?\C:\Users\...\docs\design-and-goals\style\status.css to \\?\C:\Users\...\docs\design-and-goals\gsn-svg

Caused by:
    Access is denied. (os error 5)

both happily copy (wsl and PS)

jonasthewolf commented 3 months ago

The problem here is that the error is from the underlying operating system. Could you please try export RUST_BACKTRACE=1 before running the program? It might provide additional output. If not, we might need a debug build. I was actually quite sure that that feature works, so I suspect a WSL issue here. Unfortunately, I don't have access to a WSL. Have you tried copying the file with cp in your terminal?

Ilidur commented 3 months ago

Backtrace not useful

Caused by:
    Is a directory (os error 21)

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: __libc_start_main
   5: <unknown>

I'll try building debug and trying later

jonasthewolf commented 3 months ago

The backtrace is actually useful. Let me check something.

jonasthewolf commented 3 months ago

@Ilidur Thanks for the backtraces.

I think I understand the issue now. I am not appending the file name for the destination.

As described in https://doc.rust-lang.org/std/fs/fn.copy.html, the behaviour of the function I use is platform dependent.

I will have to add the target file name for the call, too.

jonasthewolf commented 3 months ago

Let me see if I can fix this earlier than Sunday night.

Ilidur commented 3 months ago

No urgency on my end. thanks for the great work!

jonasthewolf commented 3 months ago

@Ilidur I just released v3.2.2 which should fix the issue you detected. Please reopen if it did not.