scriptlike icon indicating copy to clipboard operation
scriptlike copied to clipboard

Cross-platform way to run a program that's in the current directory.

Open Abscissa opened this issue 8 years ago • 2 comments

./somebin ... works everywhere but windows. Omitting the ./ only works on windows. Need to figure out a good way so scripts don't need awful garbage like:

run(`.`~dirSeparator~`mytool --args`);

or

run(buildPath(`.`, `mytool`)~` --args`);

or

version(Windows)
    run(`mytool --args`);
else
    run(`./mytool --args`);

Abscissa avatar Jan 30 '17 21:01 Abscissa

What about a function that does it for you? Or implement it in run itself, i.e. on Windows, run(`./mytools --args`) becomes run(`mytool --args`)? That's pretty simple and does the job.

Bolpat avatar Feb 03 '17 21:02 Bolpat

Yes, that's one of the possibilities I've been considering. Just wanted to give it all some more thought.

Abscissa avatar Feb 03 '17 21:02 Abscissa