www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rdmd with a file with no extension

reply Colin <grogan.colin gmail.com> writes:
When running a small D program through rdmd, it seems the file 
needs a .d extension to work.

```
$ ./testscript2
Error: module testscript2 is in file './testscript2.d' which 
cannot be read

$ cat testscript2


void main(string[] args){
     import std.stdio;

     writeln(args);
}

```

Trying the above on OSX if that makes a difference.

Any way to get these to work short of renaming it testscript2.d?
Mar 01 2017
parent XavierAP <n3minis-git yahoo.es> writes:
On Wednesday, 1 March 2017 at 16:06:20 UTC, Colin wrote:
 When running a small D program through rdmd, it seems the file 
 needs a .d extension to work.
It looks like the file extension is enforced: https://dlang.org/dmd-windows.html#switches Looks like a feature rather than a bug... At the command line, both "file" or "file.d" make the compiler look for "file.d". Even "file.c" is understood as "file.c.d"
Mar 01 2017