I'd really like some opinions on write_or_delete_if_found's complexity.
Added new functions, write_or_delete_if_found, write_includes and update_actor_includes. Remove writeIfNotFound and deleteIfFound
write_or_delete_if_found is a smarter version of writeIfNotFound and deleteIfFound, it optionally removes comments prior to searching (but doesn't remove comments from the actual file of course) and lets you pass in regex patterns (without worrying about comments!) which allows much smarter searchs that can tolerate whitespace, it adds a trailing newline to the file instead of each include having to include a newline (broke stuff before), the footer can now be optional (allows no endif which is great for files that use the GCC #pragma once macro)
update_actor_includes standardizes group and level includes into one place for ease of editing, one of the major differences is that level exports no longer use the full path (levels/actor/my_file.c would instead be /actor/my_file.c) this should allow level header type actors to actually update headers on custom non decomp levels but that is not done in this PR (existing includes are unaffected!).
Benifts from this pr:
New line issues are fixed
Code quality (hopefully, maybe it could be better still?)
Smarter searchs
Less file writes (probably not significant to anyone's ssd lifespan but who knows!)
I'd really like some opinions on write_or_delete_if_found's complexity.
Added new functions, write_or_delete_if_found, write_includes and update_actor_includes. Remove writeIfNotFound and deleteIfFound
write_or_delete_if_found is a smarter version of writeIfNotFound and deleteIfFound, it optionally removes comments prior to searching (but doesn't remove comments from the actual file of course) and lets you pass in regex patterns (without worrying about comments!) which allows much smarter searchs that can tolerate whitespace, it adds a trailing newline to the file instead of each include having to include a newline (broke stuff before), the footer can now be optional (allows no endif which is great for files that use the GCC
#pragma once
macro)update_actor_includes standardizes group and level includes into one place for ease of editing, one of the major differences is that level exports no longer use the full path (levels/actor/my_file.c would instead be /actor/my_file.c) this should allow level header type actors to actually update headers on custom non decomp levels but that is not done in this PR (existing includes are unaffected!).
Benifts from this pr: