[WIP]Adds support for static dm libraries#19
Conversation
| output = "" | ||
|
|
||
| if code.find("/proc/main") == -1: | ||
| libsDir = Path(os.path.realpath(__file__)) / 'StaticLibs' |
There was a problem hiding this comment.
You're gonna want to do Path(...).parent.
| continue | ||
|
|
||
| lines[index] = "\t" + line | ||
| if line.find('#include "'): |
There was a problem hiding this comment.
I would recommend using regex and finditer so you can make the parsing easier and allow multiple files.
| lines[index] = "\t" + line | ||
| if line.find('#include "'): | ||
| library = line[10:-1]; # Fetch the library name within the "" | ||
| libToCopy = libsDir.glob(library+".dm") |
There was a problem hiding this comment.
You should sanitize to make sure the path is actually in there and there's no hackery with like ../
|
So here's a fun problem: The benchmark code you pulled from Ginja's bot is licensed under AGPL. My bot is MIT. On one side you can ignore this because who cares on the other it's kinda iffy. |
|
All but There are some additional changes in GinjaNinja32/bot32@8bf6510 that I've pointed Carbonhell to; BENCHT, BENCHTK, and BENCHTM I'm likewise happy for you to use under MIT. |
|
is this still work in progress? @Carbonhell |
Adds support for users to use the #include directive to include libraries within the bot StaticLibs folder. While building the output, the code will intercept #include directives, attempt to find the library itself, and copy it over to the temp project folder.
Untested as for now. Also includes the first library, utils.dm, containing some helper procs and most important, some defines to calculate processing time easily, courtesy of GinjaNinja32: https://github.com/GinjaNinja32/bot32/blob/dev/dm/util.dm