[Issue 5360] New: calling rdmd from different folder

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 19 18:49:54 PST 2010


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

           Summary: calling rdmd from different folder
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: CrypticMetaphor88 at gmail.com


--- Comment #0 from CrypticMetaphor88 at gmail.com 2010-12-19 18:47:59 PST ---
Overview:

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::

example:

...\projectfolder\src\main.d
...\projectfolder\src\test.d

// main.d
module main;
import test.d;
void main()
{
    hello();
}
// end main.d
// test.d
module test.d;
import std.stdio;
void hello()
{
    writeln("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
build.bat
rdmd --build-only --chatty -of%1..\bin\main -I%1..\inc main.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list