"Nick Sabalausky" <a...@a.a> wrote in message news:i4ev6m$1bp...@digitalmars.com... > "Nick Sabalausky" <a...@a.a> wrote in message > news:i4et66$141...@digitalmars.com... >> "Andrei Alexandrescu" <seewebsiteforem...@erdani.org> wrote in message >> news:i4emnt$bc...@digitalmars.com... >>> >>> I saw the q, and was still mulling for an answer. I the join >>> intentionally, and now I think I remembered why. >>> >>> The join is needed in the probably rare case when you're running rdmd >>> from a different directory from the root module, e.g: >>> >>> $ pwd >>> ~/foo/bar >>> $ rdmd ../baz/main.d >>> >>> In this case, if there's no join with the rootDir, modules will be >>> looked up in ~/foo/bar/, which is probably not the right thing. >>> >>> What is your use case? >>> >> >> That's what I was starting to suspect. >> >> My case (writing this from memory, if this doesn't behave like I >> describe, then it's something along these lines): >> >> $ cat src/app/main.d >> module app.main; >> import foo; >> void main(){} >> >> $ cat src/lib/foo.d >> module lib.foo; >> >> $ xfbuild -Isrc src/app/main.d >> Works ok >> >> $ rdmd -Isrc src/app/main.d >> dmd craps out because rdmd told it to compile "src/app/src/lib/foo.d" >> > > Maybe if you just implicitly add "-I{rootDir}" to the args sent to dmd > instead of prepending rootDir? Ideally, you would also want to tell DMD to > *not* to lookup modules in the current directory (unless rootDir == > current directory), although I don't think DMD has an option for that > right now. >
I've submitted a modified rdmd.d that does exactly that: http://d.puremagic.com/issues/show_bug.cgi?id=4672 I've verified that this works for both my use-case (ie, when "-I" is needed) AND for your example (ie, making sure that modules which are relative to the main file are looked up correctly regardless of what directory rdmd is run from).