Skip to content

Commit 54491fd

Browse files
committed
Different build path for iOS
1 parent 1d98fa2 commit 54491fd

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Assets/Editor/AdjustEditor.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
public class AdjustEditor : MonoBehaviour {
88

9+
static string iOSBuildPath = "";
10+
911
[PostProcessBuild]
1012
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) {
1113
var exitCode = RunPostBuildScript (preBuild: false, pathToBuiltProject: pathToBuiltProject);
@@ -43,6 +45,23 @@ static void FixAndroidManifest() {
4345
#endif
4446
}
4547

48+
[MenuItem("Adjust/Set iOS build path")]
49+
static void SetiOSBuildPath() {
50+
#if UNITY_IOS
51+
AdjustEditor.iOSBuildPath = EditorUtility.OpenFolderPanel(
52+
title: "iOs build path",
53+
folder: EditorUserBuildSettings.GetBuildLocation(BuildTarget.iPhone),
54+
defaultName: "");
55+
if (AdjustEditor.iOSBuildPath == "") {
56+
UnityEngine.Debug.Log("iOS build path reset to default path");
57+
} else {
58+
UnityEngine.Debug.Log(string.Format("iOS build path: {0}", AdjustEditor.iOSBuildPath));
59+
}
60+
#else
61+
EditorUtility.DisplayDialog("Adjust", "Option only valid for the Android platform.", "OK");
62+
#endif
63+
}
64+
4665
static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") {
4766
string pathToScript = null;
4867
string arguments = null;
@@ -54,7 +73,11 @@ static int RunPostBuildScript (bool preBuild, string pathToBuiltProject = "") {
5473
arguments = "--pre-build " + arguments;
5574
#elif UNITY_IOS
5675
pathToScript = "/Editor/AdjustPostBuildiOS";
57-
arguments = pathToBuiltProject;
76+
if (AdjustEditor.iOSBuildPath == "") {
77+
arguments = pathToBuiltProject;
78+
} else {
79+
arguments = AdjustEditor.iOSBuildPath;
80+
}
5881
#else
5982
return -1;
6083
#endif

0 commit comments

Comments
 (0)