[Issue 1585] New: Imports should be searched relative to importing file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 16 07:50:59 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1585

           Summary: Imports should be searched relative to importing file
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: randleer at web.de


Imports should not be searched in ./ but relative to the importing file.
This way you dont have to change the current directory in order to compile, and
the imported files will always be found.


Example 1:

src/a.d
        module a;
        import b;

src/b.d
        module b;


Example 2:

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

src/bar/b.d
        module bar.b;


The compiler will be able to find files like this:

(dir-of-current-file) (go as much directories up, as there are packages in
module name) (import name)

In example 2, this becomes:
src/foo/  ../  bar/b.d


If the file is not found in this way, then the file is searched in the include
paths.


-- 



More information about the Digitalmars-d-bugs mailing list