This commit is contained in:
Vadim Lopatin 2017-08-08 10:31:17 +03:00
parent 1125fa6239
commit 2ab32a5ecf
4 changed files with 24 additions and 0 deletions

View File

@ -792,6 +792,14 @@ deprecated string[] splitPath(string path) {
return res; return res;
} }
/// if pathName is not absolute path, convert it to absolute (assuming it is relative to current directory)
string toAbsolutePath(string pathName) {
import std.path : isAbsolute, absolutePath, buildNormalizedPath;
if (pathName.isAbsolute)
return pathName;
return pathName.absolutePath.buildNormalizedPath;
}
/// for executable name w/o path, find absolute path to executable /// for executable name w/o path, find absolute path to executable
string findExecutablePath(string executableName) { string findExecutablePath(string executableName) {
import std.string : split; import std.string : split;

View File

@ -1887,6 +1887,10 @@ mixin template APP_ENTRY_POINT() {
static if (BACKEND_CONSOLE) { static if (BACKEND_CONSOLE) {
int main(string[] args) int main(string[] args)
{ {
if (args.length > 1)
args = args[1 .. $];
else
args = null;
return DLANGUImain(args); return DLANGUImain(args);
} }
} else { } else {
@ -1909,6 +1913,10 @@ mixin template APP_ENTRY_POINT() {
} else { } else {
int main(string[] args) int main(string[] args)
{ {
if (args.length > 1)
args = args[1 .. $];
else
args = null;
return DLANGUImain(args); return DLANGUImain(args);
} }
} }

View File

@ -1623,6 +1623,10 @@ int sdlmain(string[] args) {
version (unittest) { version (unittest) {
} else { } else {
if (args.length > 1)
args = args[1 .. $];
else
args = null;
res = UIAppMain(args); res = UIAppMain(args);
} }

View File

@ -1853,6 +1853,10 @@ extern(C) int DLANGUImain(string[] args)
version (unittest) { version (unittest) {
} else { } else {
if (args.length > 1)
args = args[1 .. $];
else
args = null;
res = UIAppMain(args); res = UIAppMain(args);
} }