Thread overview
rdmd bug?
Dec 20, 2010
CrypticMetaphor
Dec 20, 2010
Nick Voronin
Dec 20, 2010
CrypticMetaphor
Dec 20, 2010
CrypticMetaphor
Dec 20, 2010
spir
December 20, 2010
Hello, I'm being driven nuts by this problem, I don't know 100% if it's it's a bug or if it's intended behavior, I'm new to D( also new to reporting bugs ) so I can't really tell.

Anyway, the problem is, if I call rdmd from outside the folder in which the main source resides in, and main includes another file in that folder, I get an error.

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

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

...\projectfolder\src>Hello world

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


Anyway, I want to be able to compile with rdmd from a different folder, is this a bug? or should I use a different tool? :-S
*aahhh*

Other info:
OS: Windows
rdmd build 20101220
dmd: 2.050
December 20, 2010
On Mon, 20 Dec 2010 01:24:02 +0100
CrypticMetaphor <CrypticMetaphor88@gmail.com> wrote:

> Anyway, the problem is, if I call rdmd from outside the folder in which the main source resides in, and main includes another file in that folder, I get an error.

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

> Anyway, I want to be able to compile with rdmd from a different folder,
> is this a bug? or should I use a different tool? :-S
> *aahhh*

Add -Ifullpath_to_projectfolder\src. It's the way it works IMHO, if you import something it must be relative to search path or to current dir. There may be a better way (replace current dir with the dir where source is, but it will take away control), but this works.

There is a bug though, I can't make it work with -Irelative_path_to_src. Looks like .deps contain paths relative to where rdmd was ran, while dmd interprets them as paths relative to where .deps file is.


-- 
Nick Voronin <elfy.nv@gmail.com>
December 20, 2010
>
> Add -Ifullpath_to_projectfolder\src. It's the way it works IMHO, if you import something it must be relative to search path or to current dir. There may be a better way (replace current dir with the dir where source is, but it will take away control), but this works.
>
> There is a bug though, I can't make it work with -Irelative_path_to_src. Looks like .deps contain paths relative to where rdmd was ran, while dmd interprets them as paths relative to where .deps file is.
>

I've tried -I"path to src" but this doesn't work either, but I've found a workaround. I start a batch file that goes to the correct directory and then executes rdmd with the argument(the absolute path) I pass to the batch file, this works :D

Thanks for the help!

So, should I report this as a bug?
December 20, 2010
> So, should I report this as a bug?

What am i saying!? of course I should. It annoyed the hell outta me >_<
*goes to report*
December 20, 2010
On Mon, 20 Dec 2010 04:27:33 +0300
Nick Voronin <elfy.nv@gmail.com> wrote:

> On Mon, 20 Dec 2010 01:24:02 +0100
> CrypticMetaphor <CrypticMetaphor88@gmail.com> wrote:
> 
> > Anyway, the problem is, if I call rdmd from outside the folder in which the main source resides in, and main includes another file in that folder, I get an error.
> 
> > // 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
> 
> > Anyway, I want to be able to compile with rdmd from a different folder,
> > is this a bug? or should I use a different tool? :-S
> > *aahhh*
> 
> Add -Ifullpath_to_projectfolder\src. It's the way it works IMHO, if you import something it must be relative to search path or to current dir. There may be a better way (replace current dir with the dir where source is, but it will take away control), but this works.
> 
> There is a bug though, I can't make it work with -Irelative_path_to_src. Looks like .deps contain paths relative to where rdmd was ran, while dmd interprets them as paths relative to where .deps file is.

Yes, I think it cannot work, since -I is a option of dmd, not of rdmd. rdmd just passes by options to dmd if I understand correctly. What you want is to influence a feature provided dy rdmd, not dmd, namely automatic inclusion of (non-standard) imports.
But sure, it may be a bug: rdmd should look for imports using pathes relative to the location of the (app) module it is given. Or, for simplicity, we can just state it must be called from this location.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com