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 {
@@ -114,12 +121,12 @@ void PopUpWindow(int id)
114121 void CreatePopUpFlagFile ( )
115122 {
116123 RemovePopUpFlagFile ( ) ; // remove first to avoid any overwriting
117- System . IO . File . WriteAllText ( POPUP_FILE_FLAG , "popupshown = true" ) ;
124+ System . IO . File . WriteAllText ( popUpShownCfgPath , "popupshown = true" ) ;
118125 }
119126
120127 public static void RemovePopUpFlagFile ( )
121128 {
122- System . IO . File . Delete ( POPUP_FILE_FLAG ) ;
129+ System . IO . File . Delete ( popUpShownCfgPath ) ;
123130 }
124131 }
125132}
0 commit comments