44using KSP . IO ;
55using UnityEngine ;
66using ClickThroughFix ;
7-
7+ using System . Reflection ;
88
99namespace ClearAllInputLocks
1010{
@@ -15,12 +15,19 @@ public class OneTimePopup : MonoBehaviour
1515 const int HEIGHT = 350 ;
1616 Rect popupRect = new Rect ( 300 , 50 , WIDTH , HEIGHT ) ;
1717 bool visible = false ;
18- const string POPUP_FILE_FLAG = "GameData/000_ClickThroughBlocker/PluginData/PopUpShown.cfg" ;
18+ string popUpShownCfgPath ;
1919 string cancelStr = "Cancel (window will open next startup)" ;
2020
21+ public OneTimePopup ( )
22+ {
23+ popUpShownCfgPath = Path . Combine (
24+ Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ,
25+ "../PluginData/PopUpShown.cfg" ) ;
26+ }
27+
2128 public void Start ( )
2229 {
23- if ( HighLogic . CurrentGame . Parameters . CustomParams < ClickThroughFix . CTB > ( ) . showPopup || ! System . IO . File . Exists ( POPUP_FILE_FLAG ) )
30+ if ( HighLogic . CurrentGame . Parameters . CustomParams < ClickThroughFix . CTB > ( ) . showPopup || ! System . IO . File . Exists ( popUpShownCfgPath ) )
2431 visible = true ;
2532 if ( ClearInputLocks . modeWindow != null )
2633 {
@@ -112,12 +119,12 @@ void PopUpWindow(int id)
112119 void CreatePopUpFlagFile ( )
113120 {
114121 RemovePopUpFlagFile ( ) ; // remove first to avoid any overwriting
115- System . IO . File . WriteAllText ( POPUP_FILE_FLAG , "popupshown = true" ) ;
122+ System . IO . File . WriteAllText ( popUpShownCfgPath , "popupshown = true" ) ;
116123 }
117124
118125 public static void RemovePopUpFlagFile ( )
119126 {
120- System . IO . File . Delete ( POPUP_FILE_FLAG ) ;
127+ System . IO . File . Delete ( popUpShownCfgPath ) ;
121128 }
122129 }
123130}
0 commit comments