[Issue 12629] New: Adjust search path according to module name

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 23 14:26:39 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12629

          Issue ID: 12629
           Summary: Adjust search path according to module name
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: thecybershadow at gmail.com

Consider a project with the following structure:

a/b/foo.d:
    module a.b.foo;

a/b/bar.d:
    module a.b.bar;
    import a.b.foo;

If you run:
    ~ $ cd a/b
    ~/a/b $ dmd bar.d

DMD will fail to compile, because it will not look for "a/b/foo.d" from the
project root.

I propose the following enhancement:

Implicitly add the package root, according to the module declaration, to the
search path.

For example, if the file contains the line "module a.b.foo;", add "../.." to
the search path.

This will allow to compile modules or run D programs located in packages by
simply associating .d files with the compiler, with no further configuration.

--


More information about the Digitalmars-d-bugs mailing list