On Tuesday, 11 September 2018 at 08:53:46 UTC, Kagamin wrote:
On Saturday, 8 September 2018 at 04:24:20 UTC, Jonathan Marler wrote:
https://github.com/marler8997/rund

I have an idea how to push shebang to userland and make it crossplatform: if, say, `rund -install prog.d` would copy/link itself into current folder under name "prog" and when run would work with file args[0]~".d", this will work the same on all platforms without shebang.

So your idea is that you could run `rund -install prog.d` which would create some sort of file that allows you to run `./prog` (on POSIX) or `prog` (on WINDOWS).

So something like this:

/path/prog.d

Posix:
/path/prog -> /usr/bin/rund

Windows 10 (It supports symbolic links)
/path/prog.exe -> C:\Programs\rund.exe

Windows <10
/path/prog.exe (a copy of rund.exe)


Then this would allow you to run "/path/prog" and which would invoke rund and like you said we could take "argv[0]" and assume that's the main source file.

The Posix/Windows 10 cases seem fine, but Windows <10 is not great. In this case it has to keep an entire copy of rund around (currently 1.8M). I think we can do better. Instead, `rund -install prog.d` could generate a little "wrapper program" that forwards any calls to rund. You could make this wrapper program with a small D program, or with this BATCH script:

--- /path/prog.bat
@rund %~dp0prog.d %*

You get the same result. When you run "\path\prog" it will invoke rund with the given args for prog.d. Thoughts?

Reply via email to