www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Specify an entire directory tree for string imports

reply "Alex Parrill" <initrd.gz gmail.com> writes:
I have a directory structure like this:

	.
	|   test.d
	|
	\---test
	    |   test1.txt
	    |
	    \---subfolder
	            test2.txt

I am running test.d using this command:

	rdmd -Jtest test.d

I can do `import("test1.txt")` from test.d successfully, however, 
`import("subfolder/test2.txt")` fails with the error `file 
"subfolder/test2.txt" cannot be found or not in a path specified 
with -J`

I'm guessing that the -J option doesn't operate recursively, and 
that I'm not allowed to import files from `test/subfolder`.

Is there a way to make the entire `test` directory tree available 
for string imports?
Mar 29 2015
parent reply "Baz" <bb.temp gmx.com> writes:
On Monday, 30 March 2015 at 02:13:22 UTC, Alex Parrill wrote:
 I have a directory structure like this:

 	.
 	|   test.d
 	|
 	\---test
 	    |   test1.txt
 	    |
 	    \---subfolder
 	            test2.txt

 I am running test.d using this command:

 	rdmd -Jtest test.d

 I can do `import("test1.txt")` from test.d successfully, 
 however, `import("subfolder/test2.txt")` fails with the error 
 `file "subfolder/test2.txt" cannot be found or not in a path 
 specified with -J`

 I'm guessing that the -J option doesn't operate recursively, 
 and that I'm not allowed to import files from `test/subfolder`.

 Is there a way to make the entire `test` directory tree 
 available for string imports?
It's a DMD Windows bug. It's just been reported 2 days ago: https://issues.dlang.org/show_bug.cgi?id=14349 so nothing wrong from you side.
Mar 29 2015
next sibling parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 30/03/2015 3:51 p.m., Baz wrote:
 On Monday, 30 March 2015 at 02:13:22 UTC, Alex Parrill wrote:
 I have a directory structure like this:

     .
     |   test.d
     |
     \---test
         |   test1.txt
         |
         \---subfolder
                 test2.txt

 I am running test.d using this command:

     rdmd -Jtest test.d

 I can do `import("test1.txt")` from test.d successfully, however,
 `import("subfolder/test2.txt")` fails with the error `file
 "subfolder/test2.txt" cannot be found or not in a path specified with -J`

 I'm guessing that the -J option doesn't operate recursively, and that
 I'm not allowed to import files from `test/subfolder`.

 Is there a way to make the entire `test` directory tree available for
 string imports?
It's a DMD Windows bug. It's just been reported 2 days ago: https://issues.dlang.org/show_bug.cgi?id=14349 so nothing wrong from you side.
Well this is awkward, I knew about this 2 major releases ago and just assumed it was already reported. Or some artificial limitation. Well this brings me back down to earth after fixing a bug that was just reported via another bug fix that I PR'd 2 major releases ago (not pulled yet).
Mar 29 2015
prev sibling parent reply "Alex Parrill" <initrd.gz gmail.com> writes:
On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote:
 It's a DMD Windows bug. It's just been reported 2 days ago:

 https://issues.dlang.org/show_bug.cgi?id=14349

 so nothing wrong from you side.
Ok, glad to see it's a bug and not a (fairly limiting) feature. I might take a stab at fixing it, if it's not too hard.
Mar 30 2015
parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Monday, 30 March 2015 at 14:01:54 UTC, Alex Parrill wrote:
 On Monday, 30 March 2015 at 02:51:56 UTC, Baz wrote:
 It's a DMD Windows bug. It's just been reported 2 days ago:

 https://issues.dlang.org/show_bug.cgi?id=14349

 so nothing wrong from you side.
Ok, glad to see it's a bug and not a (fairly limiting) feature. I might take a stab at fixing it, if it's not too hard.
The limitation is probably intentional, but the reasoning is unreasonably restrictive security limitations (something about path sanitizing being more difficult on Windows than POSIX, which doesn't apply to DMD).
Mar 30 2015