Summary: calling rdmd from different folder
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-12-19 18:47:59 PST ---

Calling rdmd from outside the folder in which the main source file resides in,
and the main source file imports another file, causes an error.

Steps to reproduce:

Steps to reproduce & Actual results::



// main.d
module main;
import test.d;
void main()
// end main.d
// test.d
module test.d;
import std.stdio;
void hello()
// end test.d

// If I'm in a shell, and I do this, I get an error:
...\projectfolder>rdmd src\main.d
src\main.d(2): Error: module test is in file 'test.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import

// If I call this, I generate a main.d.deps file that can't find main.d
// last line of main.d.deps: "Error: cannot read file main.d"
...\projectfolder>rdmd -I(absolute path to src) main.d 

// but if I do this, it works:
...\projectfolder\src>rdmd main.d

...\projectfolder\src>Hello world

// also works with 
...\projectfolder\src>dmd main.d test.d // compiles

Expected results:
The application should work because the location of the main and the other
files file is known when the program is ran. Or, at least, you should be able
to specify a directory as an argument to rdmd in which rdmd will work.

Build Date & Platform:
* rdmd build 20101220
* dmd 2.050
* Windows XP Pro

Additional Information: 

I've found a workaround. I start a batch file to which I pass as argument the
absolute path to the src directory. I go to that directory in the batch file,
and execute rdmd.

Example batch file:

cd %1\src
rdmd --build-only --chatty -of%1..\bin\main -I%1..\inc main.d

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to