Get fils at compile-time
2016-12-14
Thread
bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d-learn
Is there a way to get all files in a folder at compile-time. To be more specific I want to import the content of all files within a specific folder during compile-time. I know how to do it with a specific file using `import("filename")`, but what if I wanted to do it at compile-time for all files in a folder then loop through those files and handle their content. To give an example. Let's say I have a folder "styles" it has 3 files "global.stylesheet", "main.stylesheet", "shared.stylesheet". Now I don't know about these file's names, so I can't just do it manually as they could be "foo", "bar" and "baz", just like they're "global", "main" and "shared". There could even be more files, so eventually I'd have to load all files in somehow. Ex. enum string[] compileTimeFiles = loadFilesSomehowHere("styles"); Now if it was possible to just get the file names into `compileTimeFiles` then I could use "import" on each file name, but how would I even get them into that, if it's even possible? Tbh. it's a very reasonable use-case if you ask me. Especially if it comes to dynamic generation of either code related to UI applications, web applications, websites etc.
Re: Accessing members through pointers to structs (also, CTFE associative arrays)
2016-12-13
Thread
bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 21:21:34 UTC, Ali wrote: On Tuesday, 13 December 2016 at 21:08:31 UTC, drug007 wrote: (*d.room).name Oh yeah, tried that too. That at least compiles but gives a runtime exception (bad address). Try (*cast(Room*)(d.room)).name