Skip to content

Commit

Permalink
JENKINS-30321: Unity Linux Editor Support (completely untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacostej committed Sep 7, 2015
1 parent 7009f4f commit 648a046
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/main/java/org/jenkinsci/plugins/unity3d/Functions2.java
@@ -0,0 +1,24 @@
package org.jenkinsci.plugins.unity3d;

class Functions2 {
public static boolean isMac() {
return IS_OS_MAC;
}
public static boolean isLinux() {
return IS_OS_LINUX;
}
private static final boolean IS_OS_LINUX = getOSMatchesName("Linux") || getOSMatchesName("LINUX");
private static final boolean IS_OS_MAC = getOSMatchesName("Mac");

private static final String OS_NAME = System.getProperty("os.name");

private static boolean getOSMatchesName(String osNamePrefix) {
return isOSNameMatch(OS_NAME, osNamePrefix);
}
static boolean isOSNameMatch(String osName, String osNamePrefix) {
if (osName == null) {
return false;
}
return osName.startsWith(osNamePrefix);
}
}
Expand Up @@ -94,8 +94,10 @@ boolean isVariableExpanded() {
private static File getExeFile(File unityHome) {
if (Functions.isWindows()) {
return new File(unityHome, "Editor/Unity.exe");
} else { // mac assumed
} else if (Functions2.isMac()) {
return new File(unityHome, "Contents/MacOS/Unity");
} else { // Linux assumed
return new File(unityHome, "Editor/Unity");
}
}

Expand Down Expand Up @@ -170,9 +172,12 @@ private File getEditorLogFile(String customLogFile) {
}
File applocaldata = new File(localAppData);
return new File(applocaldata, "Unity/Editor/Editor.log");
} else { // mac assumed
} else if (Functions2.isMac()) {
File userhome = new File(EnvVars.masterEnvVars.get("HOME"));
return new File(userhome, "Library/Logs/Unity/Editor.log");
} else { // Linux assumed
File userhome = new File(EnvVars.masterEnvVars.get("HOME"));
return new File(userhome, ".config/unity3d/Editor.log");
}
}

Expand Down

0 comments on commit 648a046

Please sign in to comment.