objectionary / normalizer

Command Line Normalizer of 𝜑-calculus Expressions
https://www.objectionary.com/normalizer/
MIT License
7 stars 2 forks source link

target directory is not auto-created #497

Open yegor256 opened 1 day ago

yegor256 commented 1 day ago

I'm doing this:

normalizer transform --rules /hone/simple.yml /target/generated-sources/phi/org/eolang/hone/package-info.phi --single -o /target/generated-sources/phi-optimized/org/eolang/hone/package-info.phi

The directory /target/generated-sources/phi-optimized/org/eolang/hone/ is absent, but /target/generated-sources is present. I'm getting:

normalizer: /target/generated-sources/phi-optimized/org/eolang/hone/package-info.phi: openFile: does not exist (No such file or directory)

Would be much better if Normalizer would create the target directory automatically.

yegor256 commented 1 day ago

@deemp please, take a look

yegor256 commented 18 hours ago

@deemp we will appreciate if you resolve it ASAP, it's blocking us

deemp commented 16 hours ago

@yegor256, As a quick fix, I suggest using the mkdir command before calling normalizer.

I will add support for directory creation and will release the new version of normalizer today.

deemp commented 13 hours ago

@yegor256, I thought a bit more on the issue.

I think creating missing directories by default is not a good option because:

I can add the -p or --create-parent-directories flag to the transform command. When the flag is enabled, normalizer will create the missing directories.

@yegor256, do you need such a flag?

yegor256 commented 10 hours ago

@deemp sounds like a good plan, let's add a flag. Even though, keep in mind, that for example javac compiler doesn't need a flag for that: it creates directories by default.

deemp commented 6 hours ago

@yegor256, what is the reasoning behind this decision in the javac compiler?

Even though, keep in mind, that for example javac compiler doesn't need a flag for that: it creates directories by default.

deemp commented 6 hours ago

@yegor256, I misunderstood your original request. I see that normalizer throws an error because there are no parent directories for the output file. I agree that the normalizer should create such directories without a flag.