diff --git a/ClickThroughBlocker/OneTimePopup.cs b/ClickThroughBlocker/OneTimePopup.cs index 665a572..558f490 100644 --- a/ClickThroughBlocker/OneTimePopup.cs +++ b/ClickThroughBlocker/OneTimePopup.cs @@ -4,7 +4,7 @@ using KSP.IO; using UnityEngine; using ClickThroughFix; - +using System.Reflection; namespace ClearAllInputLocks { @@ -15,12 +15,19 @@ public class OneTimePopup : MonoBehaviour const int HEIGHT = 350; Rect popupRect = new Rect(300, 50, WIDTH, HEIGHT); bool visible = false; - const string POPUP_FILE_FLAG = "GameData/000_ClickThroughBlocker/PluginData/PopUpShown.cfg"; + string popUpShownCfgPath; string cancelStr = "Cancel (window will open next startup)"; + public OneTimePopup() + { + popUpShownCfgPath = Path.Combine( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "../PluginData/PopUpShown.cfg"); + } + public void Start() { - if (HighLogic.CurrentGame.Parameters.CustomParams().showPopup || !System.IO.File.Exists(POPUP_FILE_FLAG)) + if (HighLogic.CurrentGame.Parameters.CustomParams().showPopup || !System.IO.File.Exists(popUpShownCfgPath)) visible = true; if (ClearInputLocks.modeWindow != null) { @@ -114,12 +121,12 @@ void PopUpWindow(int id) void CreatePopUpFlagFile() { RemovePopUpFlagFile(); // remove first to avoid any overwriting - System.IO.File.WriteAllText(POPUP_FILE_FLAG, "popupshown = true"); + System.IO.File.WriteAllText(popUpShownCfgPath, "popupshown = true"); } public static void RemovePopUpFlagFile() { - System.IO.File.Delete(POPUP_FILE_FLAG); + System.IO.File.Delete(popUpShownCfgPath); } } }