|
2 | 2 | using UnityEditor.SceneManagement; |
3 | 3 | using System.Linq; |
4 | 4 | using System.Diagnostics; |
| 5 | +using System.IO; |
| 6 | +using System; |
5 | 7 |
|
6 | 8 | namespace PatchKit.Unity |
7 | 9 | { |
8 | | - public class CustomBuildScripts |
| 10 | + public class CustomBuildScripts |
9 | 11 | { |
10 | 12 | [MenuItem("Tools/Build/Windows x86")] |
11 | 13 | public static void BuildWindows86 () |
@@ -37,44 +39,47 @@ public static void BuildLinux () |
37 | 39 | Build(BuildTarget.StandaloneLinuxUniversal); |
38 | 40 | } |
39 | 41 |
|
40 | | - [MenuItem("Tools/Build/OSX")] |
41 | | - public static void BuildOsx () |
42 | | - { |
43 | | - Build(BuildTarget.StandaloneOSXIntel); |
44 | | - } |
45 | | - |
46 | 42 | [MenuItem("Tools/Build/OSX x64")] |
47 | 43 | public static void BuildOsx64 () |
48 | 44 | { |
49 | 45 | Build(BuildTarget.StandaloneOSXIntel64); |
50 | 46 | } |
51 | 47 |
|
52 | | - [MenuItem("Tools/Build/OSX Universal")] |
53 | | - public static void BuildOsxUniversal () |
54 | | - { |
55 | | - Build(BuildTarget.StandaloneOSXUniversal); |
56 | | - } |
57 | | - |
58 | 48 | private static string PatcherExecutableName(BuildTarget target) |
59 | 49 | { |
60 | 50 | switch (target) |
61 | 51 | { |
62 | 52 | case BuildTarget.StandaloneWindows: |
63 | 53 | case BuildTarget.StandaloneWindows64: |
64 | 54 | return "Patcher.exe"; |
65 | | - |
66 | 55 | case BuildTarget.StandaloneLinux: |
67 | 56 | case BuildTarget.StandaloneLinux64: |
68 | 57 | case BuildTarget.StandaloneLinuxUniversal: |
69 | 58 | return "Patcher"; |
70 | | - |
71 | | - case BuildTarget.StandaloneOSXIntel: |
72 | 59 | case BuildTarget.StandaloneOSXIntel64: |
73 | | - case BuildTarget.StandaloneOSXUniversal: |
74 | 60 | return "Patcher.app"; |
| 61 | + default: |
| 62 | + throw new NotSupportedException(); |
| 63 | + } |
| 64 | + } |
75 | 65 |
|
| 66 | + public static string PatcherDataDirectory(BuildTarget target, string executablePath) |
| 67 | + { |
| 68 | + switch (target) |
| 69 | + { |
| 70 | + case BuildTarget.StandaloneWindows: |
| 71 | + case BuildTarget.StandaloneWindows64: |
| 72 | + case BuildTarget.StandaloneLinux: |
| 73 | + case BuildTarget.StandaloneLinux64: |
| 74 | + case BuildTarget.StandaloneLinuxUniversal: |
| 75 | + string buildDir = Path.GetDirectoryName(executablePath); |
| 76 | + string patcherName = Path.GetFileNameWithoutExtension (executablePath); |
| 77 | + |
| 78 | + return Path.Combine(buildDir, patcherName + "_Data"); |
| 79 | + case BuildTarget.StandaloneOSXIntel64: |
| 80 | + return Path.Combine(executablePath, "Contents"); |
76 | 81 | default: |
77 | | - return ""; |
| 82 | + throw new NotSupportedException(); |
78 | 83 | } |
79 | 84 | } |
80 | 85 |
|
@@ -133,7 +138,7 @@ private static void Build(BuildTarget target) |
133 | 138 | } |
134 | 139 | } |
135 | 140 |
|
136 | | - BuildOptions buildOptions = BuildOptions.ForceEnableAssertions |
| 141 | + BuildOptions buildOptions = BuildOptions.ForceEnableAssertions |
137 | 142 | | BuildOptions.ShowBuiltPlayer; |
138 | 143 |
|
139 | 144 | string path = EditorUtility.SaveFolderPanel("Choose where to build the Patcher", "", ""); |
|
0 commit comments