Thread overview
[Issue 5360] New: calling rdmd from different folder
Dec 28, 2010
Nick Sabalausky
December 20, 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@puremagic.com
        ReportedBy: CrypticMetaphor88@gmail.com


--- Comment #0 from CrypticMetaphor88@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: -------
December 20, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5360



--- Comment #1 from CrypticMetaphor88@gmail.com 2010-12-19 18:50:16 PST ---
> cd %1\src
> build.bat
> rdmd --build-only --chatty -of%1..\bin\main -I%1..\inc main.d

I meant

cd %1\src
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: -------
December 20, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5360



--- Comment #2 from CrypticMetaphor88@gmail.com 2010-12-19 19:10:34 PST ---
(In reply to comment #1)
> > cd %1\src
> > build.bat
> > rdmd --build-only --chatty -of%1..\bin\main -I%1..\inc main.d
> 
> I meant
> 
> cd %1\src
> rdmd --build-only --chatty -of%1..\bin\main -I%1..\inc main.d

what I really meant:

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5360


Nick Sabalausky <cbkbbejeap@mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbkbbejeap@mailinator.com


--- Comment #3 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2010-12-27 22:45:48 PST ---
I'm pretty sure this is a duplicate of issue 4672

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5360


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=5360


Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #4 from Andrei Alexandrescu <andrei@erdani.com> 2013-02-26 08:06:06 PST ---
According to my tests this is fixed, please reopen if you find other cases that need addressing.

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