How does the compiler look for the files of imports?

BCS ao at pathlink.com
Tue Sep 18 16:31:08 PDT 2007


Reply to Gregor,

> BCS wrote:
> 
>> Reply to Jakob,
>> 
>>> I have the following files:
>>> 
>>> foo/bar.d
>>> module foo.bar;
>>> import lol.rofl;
>>> lol/rofl.d
>>> module lol.rofl;
>>> If i change to the directory where "foo" and "lol" are in, and do
>>> gdc foo/bar.d lol/rofl.d
>>> it finds all the files.
>>> If i change to the directory "foo/" and do
>>> gdc bar.d ../lol/rofl
>>> it doesn't compile:
>>> bar.d:3: module rofl cannot read file 'lol/rofl.d'
>>> IMHO, the compiler should notice that the module name is 'foo.bar'
>>> (and not only 'bar') and so the directory to search for imports is
>>> the parent directory. Or what do you think about that?
>>> 
>> vote += bigNum;
>> 
> vote -= bigNum;
> 
> The compiler should not trounce all over your file system if you give
> it a broken module name. It's your responsibility to arrange your
> source such that the compiler can find it, not the compiler's
> responsibility to seek it out.
> 
> - Gregor Richards
> 

What I want is not the compiler trying to find files. What I want is the 
compiler tying to find the root. The files still must be in the correct places, 
but I don't want to have to run DMD from correct place.





More information about the Digitalmars-d mailing list