Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.path;
- import std.stdio;
- import std.process;
- // Launcher. Python virtual environment programs launcher on linux.
- void main(string[] args)
- {
- if (args.length > 1)
- {
- string program = args[1];
- auto ext = extension(program);
- if (ext != ".py")
- {
- if (ext.length == 0)
- {
- program ~= ".py";
- }
- else
- {
- writeln("Looking for python file extension");
- return;
- }
- }
- auto homedir = environment.get("HOME");
- //writeln(homedir, " -- ", homedir.expandTilde);
- auto pid = spawnProcess([homedir ~ "/env/bin/python", program]);
- auto exitCode = wait(pid);
- }
- else
- {
- writeln("Missing python file name");
- }
- }
Advertisement