WingedSeal / jmc

A compiler for JMC (JavaScript-like Minecraft Function), a mcfunction extension language for making Minecraft Datapack
https://jmc.wingedseal.com
MIT License
64 stars 8 forks source link

[BUG] Override namespaces aren't being deleted before being written to #40

Closed w00tyd00d closed 10 months ago

w00tyd00d commented 11 months ago

Describe the bug

Using the #override keyword in the header file will not delete the target namespace folder before writing to it.

To Reproduce

  1. Add a namespace override to the project header file. (eg: #override namespace2)
  2. Create a function within the namespace scope in your main.jmc file. (eg: function namespace2.test() {...})
  3. Compile the project. It should generate the new namespace folder and function within it.
  4. Go back to main.jmc and delete/comment out the function we just created.
  5. Recompile project. The new namespace folder and function file will not be deleted.
  6. (Optional) Add another function to the main.jmc file with a different name (eg: function namespace2.test2() {...})
  7. (Optional) Recompile the project. The second function gets appended to the new namespace without deleting the first.

Expected behavior

The namespaces declared by the #override header keyword should be deleted prior to being written to, which isn't currently happening.

Screenshots

image image

Desktop

Additional context

It should be noted this only seems to happen to namespaces that are affected by the #override header, as the main namespace used for the project is overwritten correctly.