Skip to content

Commit

Permalink
* **FIX**: Moved TestFlight settings file to PluginData so that it do…
Browse files Browse the repository at this point in the history
…esn't cause ModuleManager recaching when settings change. **Important Note**: TestFlight will automatically migrate the settings file for you the first time, but it won't be able to clean up the old file. Once migration happens you can freely delete the old file if desired.
  • Loading branch information
jwvanderbeck committed Mar 25, 2016
1 parent 22193f0 commit 90c0055
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
Binary file modified GameData/TestFlight/Plugins/TestFlight.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightAPI.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightContracts.dll
Binary file not shown.
Binary file modified GameData/TestFlight/Plugins/TestFlightCore.dll
Binary file not shown.
46 changes: 43 additions & 3 deletions TestFlightCore/TestFlightCore/TestFlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;


using UnityEngine;
Expand Down Expand Up @@ -198,6 +199,7 @@ public class TestFlightManager : MonoBehaviourExtended
float lastFailurePoll = 0.0f;
float lastMasterStatusUpdate = 0.0f;


internal void Log(string message)
{
bool debug = TestFlightManagerScenario.Instance.userSettings.debugLog;
Expand Down Expand Up @@ -734,14 +736,52 @@ private void encodeRawSaveData()
}
}

#region Assembly/Class Information
/// <summary>
/// Name of the Assembly that is running this MonoBehaviour
/// </summary>
internal static String _AssemblyName
{ get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; } }

/// <summary>
/// Full Path of the executing Assembly
/// </summary>
internal static String _AssemblyLocation
{ get { return System.Reflection.Assembly.GetExecutingAssembly().Location; } }

/// <summary>
/// Folder containing the executing Assembly
/// </summary>
internal static String _AssemblyFolder
{ get { return System.IO.Path.GetDirectoryName(_AssemblyLocation); } }

#endregion


public override void OnAwake()
{
Instance = this;
if (userSettings == null)

// v1.5.4 moved settings to PluginData but to avoid screwing over existing installs we want to migrate existing settings
string pdSettingsFile = System.IO.Path.Combine(_AssemblyFolder, "PluginData/settings.cfg");
string settingsFile = System.IO.Path.Combine(_AssemblyFolder, "../settings.cfg");
if (!System.IO.File.Exists(pdSettingsFile) && System.IO.File.Exists(settingsFile))
{
userSettings = new UserSettings("../settings.cfg");
if (bodySettings == null)
bodySettings = new BodySettings("../settings_bodies.cfg");
userSettings.Load();
string pdDir = System.IO.Path.Combine(_AssemblyFolder, "PluginData");
System.IO.Directory.CreateDirectory(pdDir);
userSettings.Save(pdSettingsFile);
System.IO.File.Delete(settingsFile);
}

if (userSettings == null)
userSettings = new UserSettings("PluginData/settings.cfg");
if (userSettings.FileExists)
{
userSettings.Load();

}

if (userSettings.FileExists)
userSettings.Load();
Expand Down

0 comments on commit 90c0055

Please sign in to comment.