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.
  • ... bauss (wtf happend to my name took some old cached title LOL??) via Digitalmars-d-learn
    • ... bauss via Digitalmars-d-learn
    • ... rikki cattermole via Digitalmars-d-learn
      • ... Bauss via Digitalmars-d-learn
        • ... rikki cattermole via Digitalmars-d-learn
    • ... Jacob Carlborg via Digitalmars-d-learn
      • ... Bauss via Digitalmars-d-learn

Reply via email to