diff --git a/Assets/Editor/BuildScript.cs b/Assets/Editor/BuildScript.cs index 57fe8565..05c851ec 100644 --- a/Assets/Editor/BuildScript.cs +++ b/Assets/Editor/BuildScript.cs @@ -27,16 +27,6 @@ public static void BuildWindows64Development() Build(BuildTarget.StandaloneWindows64, true); } - public static void BuildOSX32Release() - { - Build(BuildTarget.StandaloneOSXIntel, false); - } - - public static void BuildOSX32Development() - { - Build(BuildTarget.StandaloneOSXIntel, true); - } - public static void BuildOSX64Release() { Build(BuildTarget.StandaloneOSXIntel64, false); diff --git a/Assets/PatchKit Patcher/Editor/CustomBuilding.cs b/Assets/PatchKit Patcher/Editor/CustomBuilding.cs index b2a092a4..a086790e 100644 --- a/Assets/PatchKit Patcher/Editor/CustomBuilding.cs +++ b/Assets/PatchKit Patcher/Editor/CustomBuilding.cs @@ -2,10 +2,12 @@ using UnityEditor.SceneManagement; using System.Linq; using System.Diagnostics; +using System.IO; +using System; namespace PatchKit.Unity { - public class CustomBuildScripts + public class CustomBuildScripts { [MenuItem("Tools/Build/Windows x86")] public static void BuildWindows86 () @@ -37,24 +39,12 @@ public static void BuildLinux () Build(BuildTarget.StandaloneLinuxUniversal); } - [MenuItem("Tools/Build/OSX")] - public static void BuildOsx () - { - Build(BuildTarget.StandaloneOSXIntel); - } - [MenuItem("Tools/Build/OSX x64")] public static void BuildOsx64 () { Build(BuildTarget.StandaloneOSXIntel64); } - [MenuItem("Tools/Build/OSX Universal")] - public static void BuildOsxUniversal () - { - Build(BuildTarget.StandaloneOSXUniversal); - } - private static string PatcherExecutableName(BuildTarget target) { switch (target) @@ -62,19 +52,34 @@ private static string PatcherExecutableName(BuildTarget target) case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows64: return "Patcher.exe"; - case BuildTarget.StandaloneLinux: case BuildTarget.StandaloneLinux64: case BuildTarget.StandaloneLinuxUniversal: return "Patcher"; - - case BuildTarget.StandaloneOSXIntel: case BuildTarget.StandaloneOSXIntel64: - case BuildTarget.StandaloneOSXUniversal: return "Patcher.app"; + default: + throw new NotSupportedException(); + } + } + public static string PatcherDataDirectory(BuildTarget target, string executablePath) + { + switch (target) + { + case BuildTarget.StandaloneWindows: + case BuildTarget.StandaloneWindows64: + case BuildTarget.StandaloneLinux: + case BuildTarget.StandaloneLinux64: + case BuildTarget.StandaloneLinuxUniversal: + string buildDir = Path.GetDirectoryName(executablePath); + string patcherName = Path.GetFileNameWithoutExtension (executablePath); + + return Path.Combine(buildDir, patcherName + "_Data"); + case BuildTarget.StandaloneOSXIntel64: + return Path.Combine(executablePath, "Contents"); default: - return ""; + throw new NotSupportedException(); } } @@ -133,7 +138,7 @@ private static void Build(BuildTarget target) } } - BuildOptions buildOptions = BuildOptions.ForceEnableAssertions + BuildOptions buildOptions = BuildOptions.ForceEnableAssertions | BuildOptions.ShowBuiltPlayer; string path = EditorUtility.SaveFolderPanel("Choose where to build the Patcher", "", ""); diff --git a/Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs b/Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs index d9a256b3..ce3fb126 100644 --- a/Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs +++ b/Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using JetBrains.Annotations; using Newtonsoft.Json; using UnityEditor; @@ -13,25 +14,24 @@ public static class PatcherManifestCreator [PostProcessBuild, UsedImplicitly] private static void PostProcessBuild(BuildTarget buildTarget, string buildPath) { - Manifest manifest = new Manifest(); + Manifest manifest; - if (buildTarget == BuildTarget.StandaloneWindows || buildTarget == BuildTarget.StandaloneWindows64) + switch (buildTarget) { - manifest = WindowsManifest(buildPath); - } - - if (buildTarget == BuildTarget.StandaloneOSXUniversal || - buildTarget == BuildTarget.StandaloneOSXIntel || - buildTarget == BuildTarget.StandaloneOSXIntel64) - { - manifest = OsxManifest(buildPath); - } - - if (buildTarget == BuildTarget.StandaloneLinux || - buildTarget == BuildTarget.StandaloneLinux64 || - buildTarget == BuildTarget.StandaloneLinuxUniversal) - { - manifest = LinuxManifest(buildPath); + case BuildTarget.StandaloneWindows: + case BuildTarget.StandaloneWindows64: + manifest = WindowsManifest(buildPath); + break; + case BuildTarget.StandaloneOSXIntel64: + manifest = OsxManifest(buildPath); + break; + case BuildTarget.StandaloneLinux: + case BuildTarget.StandaloneLinux64: + case BuildTarget.StandaloneLinuxUniversal: + manifest = LinuxManifest(buildPath); + break; + default: + throw new NotSupportedException(); } string manifestPath = Path.Combine(Path.GetDirectoryName(buildPath), "patcher.manifest"); diff --git a/Assets/PatchKit Patcher/Editor/ScreenSizeCorrection.cs b/Assets/PatchKit Patcher/Editor/ScreenSizeCorrection.cs index bd321225..52f65c84 100644 --- a/Assets/PatchKit Patcher/Editor/ScreenSizeCorrection.cs +++ b/Assets/PatchKit Patcher/Editor/ScreenSizeCorrection.cs @@ -12,7 +12,7 @@ public static class ScreenSizeCorrection public static void SaveScreenSize(BuildTarget buildTarget, string buildPath) { string content = string.Format("{0} {1}", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight); - string filename = Path.Combine(Path.GetDirectoryName(buildPath), BorderlessWindow.ScreenSizeFilename); + string filename = Path.Combine(CustomBuildScripts.PatcherDataDirectory(buildTarget, buildPath), BorderlessWindow.ScreenSizeFilename); File.WriteAllText(filename, content); } diff --git a/Assets/PatchKit Patcher/Scripts/UI/BorderlessWindow.cs b/Assets/PatchKit Patcher/Scripts/UI/BorderlessWindow.cs index 9f14a185..a3d3fc0a 100644 --- a/Assets/PatchKit Patcher/Scripts/UI/BorderlessWindow.cs +++ b/Assets/PatchKit Patcher/Scripts/UI/BorderlessWindow.cs @@ -144,15 +144,16 @@ private void Awake() private void EnforceCorrectScreenSize() { - _logger.LogDebug("Reading correct screen size from " + ScreenSizeFilename); + string screenSizeFilePath = Path.Combine(Application.dataPath, ScreenSizeFilename); + _logger.LogDebug("Reading correct screen size from " + screenSizeFilePath); - if (!File.Exists(ScreenSizeFilename)) + if (!File.Exists(screenSizeFilePath)) { - _logger.LogWarning(ScreenSizeFilename + " file does not exist."); + _logger.LogWarning(screenSizeFilePath + " file does not exist."); return; } - var screenResolutionText = File.ReadAllText(ScreenSizeFilename).Split(' '); + var screenResolutionText = File.ReadAllText(screenSizeFilePath).Split(' '); try { diff --git a/Assets/PatchKit Patcher/Scripts/Version.cs b/Assets/PatchKit Patcher/Scripts/Version.cs index e5aa1f8d..b9a7ad7d 100644 --- a/Assets/PatchKit Patcher/Scripts/Version.cs +++ b/Assets/PatchKit Patcher/Scripts/Version.cs @@ -4,7 +4,7 @@ public static class Version { public const int Major = 3; public const int Minor = 10; - public const int Release = 2; + public const int Release = 3; public static string Value { diff --git a/CHANGELOG.md b/CHANGELOG.md index 2709045f..1c03ca44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [3.10.3] +### Fixed +- Fix issue with locating screensize file + ## [3.10.2] ### Fixed - An edge case which caused the download to never terminate