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 7 forks source link

[BUG] #73

Closed linked3 closed 5 months ago

linked3 commented 5 months ago

Describe the bug

Error telling me that the directory is not empty. Unexpected error causes program to crash OSError [WinError 145] El directorio no está vacío: 'C:\\Users\\me\\AppData\\Roaming\\com.modrinth.theseus\\profiles\\Datapacking\\datapacks\\no-elytra-take-off\\src\\..\\data\\no_elytra_take_off\\functions' Traceback (most recent call last): File "C:\Users\me\anaconda3\Lib\site-packages\jmc\terminal_commands.py", line 62, in compile_ compile_jmc(global_data.config, debug=True) File "C:\Users\me\anaconda3\Lib\site-packages\jmc\compile\compiling.py", line 40, in compile_jmc build(lexer.datapack, config, is_delete, cert_config, cert_file) File "C:\Users\me\anaconda3\Lib\site-packages\jmc\compile\compiling.py", line 288, in build rmtree(folder, statics) File "C:\Users\me\anaconda3\Lib\site-packages\jmc\compile\compiling.py", line 159, in rmtree folder.rmdir() File "C:\Users\me\anaconda3\Lib\pathlib.py", line 1156, in rmdir os.rmdir(self) OSError: [WinError 145] El directorio no está vacío: 'C:\\Users\\me\\AppData\\Roaming\\com.modrinth.theseus\\profiles\\Datapacking\\datapacks\\no-elytra-take-off\\src\\..\\data\\no_elytra_take_off\\functions'

To Reproduce

[Steps to reproduce the behavior]

  1. Add #static "predicates" to your main.hjmc
  2. Create predicates folder under namespace
  3. not sure wether you need these inside predicates/, but I added two json files here one called works.json and another should_work_as_well.json both filled with: { "condition": "minecraft:random_chance", "chance": 1 }
  4. Add this function to main.jmc function works() { if (predicate __namespace__:works) { say "hi"; } else if(predicate __namespace__:should_work_as_well) { say "hello"; } }
  5. Compile 2 or 3 times until the error appears

Expected behavior

not crash as soon as I add the predicates folder in combination with calling the predicates in an if else block?

Desktop

Screenshot

dafdsaf

linked3 commented 5 months ago

I know you can use predicates with any of as their condition but still this error is weird

linked3 commented 5 months ago

this error actually started happening now unrelated to anything specific I feel like. Not sure if you can even reproduce it. It just says it whenever there is stuff in the functions folder. I have to delete the folder every time to compile.

WingedSeal commented 5 months ago

Should be fixed in https://github.com/WingedSeal/jmc/commit/70cd87291945fc7acbfe9bf24d971706c2dc976e