From d768e6054579b542d6899b8a4080a33e3a73cf16 Mon Sep 17 00:00:00 2001 From: Ville Tuhkanen Date: Wed, 28 Mar 2018 23:03:50 +0300 Subject: [PATCH] Support relative paths from command line Add support for providing product path argument as relative path. This makes it easier to open projects from command line as user doesn't need to provide full path to project directory. It also allows opening the project from current directory by providing . as path argument. Check for relative path was done with just checking if the path isn't a rooted path. If more thorough checks are needed, this StackOverflow thread has discussion on how the current check could be extended. https://stackoverflow.com/questions/5565029/check-if-full-path-given/35046453 --- UnityLauncher/Form1.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UnityLauncher/Form1.cs b/UnityLauncher/Form1.cs index 9ce950e..a4c34f3 100644 --- a/UnityLauncher/Form1.cs +++ b/UnityLauncher/Form1.cs @@ -73,6 +73,12 @@ void Start() // path var projectPathArgument = args[2]; + // resolve full path if path parameter isn't a rooted path + if (!Path.IsPathRooted(projectPathArgument)) + { + projectPathArgument = Directory.GetCurrentDirectory() + projectPathArgument; + } + var version = Tools.GetProjectVersion(projectPathArgument); // take extra arguments also