Skip to content

Commit

Permalink
Use proper linux path
Browse files Browse the repository at this point in the history
  • Loading branch information
Azurelol committed Jun 14, 2021
1 parent 314fd52 commit 1747561
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/groovy/wooga/gradle/unity/UnityPluginConventions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class UnityPluginConventions implements PlatformUtilsImpl {
*/
static File UNITY_LICENSE_DIRECTORY_MAC_OS = new File("/Library/Application Support/Unity/")

/**
* {@code File} to Unity license directory on macOS.
* @value "/Library/Application Support/Unity/"
*/
static File UNITY_LICENSE_DIRECTORY_LINUX = new File("${unixUserHomePath}/share/unity3d/Unity/")

/**
* {@code File} to Unity license directory on windows.
* @value "C:\ProgramData\Unity"
Expand All @@ -66,7 +72,7 @@ class UnityPluginConventions implements PlatformUtilsImpl {
/**
* The path to the Unity Editor executable
*/
static final PropertyLookup unityPath = new PropertyLookup(["UNITY_UNITY_PATH","UNITY_PATH"], "unity.unityPath", { getPlatformUnityPath().absolutePath })
static final PropertyLookup unityPath = new PropertyLookup(["UNITY_UNITY_PATH", "UNITY_PATH"], "unity.unityPath", { getPlatformUnityPath().absolutePath })
/**
* Used for authentication with Unity's servers
*/
Expand Down Expand Up @@ -118,9 +124,9 @@ class UnityPluginConventions implements PlatformUtilsImpl {
licensePath = UnityPluginConventions.UNITY_LICENSE_DIRECTORY_WIN
} else if (isMac()) {
licensePath = UnityPluginConventions.UNITY_LICENSE_DIRECTORY_MAC_OS
}
else{
licensePath = new File("")
} else {
licensePath = UnityPluginConventions.UNITY_LICENSE_DIRECTORY_LINUX

}

licensePath
Expand Down
8 changes: 8 additions & 0 deletions src/main/groovy/wooga/gradle/unity/utils/PlatformUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ trait PlatformUtilsImpl {
}
path
}

/**
* Returns the pat to the usr directory in UNIX
* @return
*/
static String getUnixUserHomePath() {
System.getProperty("user.home")
}
}

class PlatformUtils implements PlatformUtilsImpl {
Expand Down

0 comments on commit 1747561

Please sign in to comment.