Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit d768e60

Browse files
author
Ville Tuhkanen
committed
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
1 parent 3caec9d commit d768e60

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

UnityLauncher/Form1.cs

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ void Start()
7373
// path
7474
var projectPathArgument = args[2];
7575

76+
// resolve full path if path parameter isn't a rooted path
77+
if (!Path.IsPathRooted(projectPathArgument))
78+
{
79+
projectPathArgument = Directory.GetCurrentDirectory() + projectPathArgument;
80+
}
81+
7682
var version = Tools.GetProjectVersion(projectPathArgument);
7783

7884
// take extra arguments also

0 commit comments

Comments
 (0)