diff --git a/src/dlangui/core/files.d b/src/dlangui/core/files.d index 7750a922..7dc06598 100644 --- a/src/dlangui/core/files.d +++ b/src/dlangui/core/files.d @@ -792,6 +792,14 @@ deprecated string[] splitPath(string path) { 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 string findExecutablePath(string executableName) { import std.string : split; diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index a16d3b7c..1feffaac 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -1887,6 +1887,10 @@ mixin template APP_ENTRY_POINT() { static if (BACKEND_CONSOLE) { int main(string[] args) { + if (args.length > 1) + args = args[1 .. $]; + else + args = null; return DLANGUImain(args); } } else { @@ -1909,6 +1913,10 @@ mixin template APP_ENTRY_POINT() { } else { int main(string[] args) { + if (args.length > 1) + args = args[1 .. $]; + else + args = null; return DLANGUImain(args); } } diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index bb124a7c..64660dad 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -1623,6 +1623,10 @@ int sdlmain(string[] args) { version (unittest) { } else { + if (args.length > 1) + args = args[1 .. $]; + else + args = null; res = UIAppMain(args); } diff --git a/src/dlangui/platforms/x11/x11app.d b/src/dlangui/platforms/x11/x11app.d index 10c8d769..fb647027 100644 --- a/src/dlangui/platforms/x11/x11app.d +++ b/src/dlangui/platforms/x11/x11app.d @@ -1853,6 +1853,10 @@ extern(C) int DLANGUImain(string[] args) version (unittest) { } else { + if (args.length > 1) + args = args[1 .. $]; + else + args = null; res = UIAppMain(args); }