July 03

Is it possible to import module that is not in the module's current directory's folder or subfolders?

For example:

I want to import somemodule2.d and somemodule3.d into a somemodule.d

.\somefolder\somemodule.d
.\somemodule2.d
.\someotherfolder\somemodule3.d

July 03

On Sunday, 3 July 2022 at 05:40:30 UTC, BoQsc wrote:

>

Is it possible to import module that is not in the module's current directory's folder or subfolders?

For example:

I want to import somemodule2.d and somemodule3.d into a somemodule.d

.\somefolder\somemodule.d
.\somemodule2.d
.\someotherfolder\somemodule3.d

Yes. You just have to pass the folders with the modules in them to the compiler with the -I flag, or (if you're using dub) add the folders to your importPaths.

dmd -Isomeotherfolder -c somefolder\somemodule.d