@@ -728,14 +728,8 @@ private void textBoxContentName_TextChanged(object sender, EventArgs e)
728728 var current = bindingSourceContent . Current as ContentFolder ;
729729 if ( current != null && current . Name != textBoxContentName . Text )
730730 {
731- if ( current . Path . ToLower ( ) . Contains ( Application . StartupPath . ToLower ( ) ) )
731+ if ( isWrongPath ( current . Path , catalog ) )
732732 {
733- // Block added because a succesful Update operation will empty the Open Rails folder and lose any content stored within it.
734- MessageBox . Show ( catalog . GetString
735- ( $ "Cannot use content from any folder which lies inside the Open Rails folder { Application . StartupPath } \n \n ")
736- , "Invalid content location"
737- , MessageBoxButtons . OK
738- , MessageBoxIcon . Error ) ;
739733 DeleteContent ( ) ;
740734 return ;
741735 }
@@ -792,6 +786,22 @@ private void checkPerformanceTuner_Click(object sender, EventArgs e)
792786 labelPerformanceTunerTarget . Enabled = checkPerformanceTuner . Checked ;
793787 }
794788
789+ public static bool isWrongPath ( string path , GettextResourceManager catalog )
790+ {
791+ if ( path . ToLower ( ) . Contains ( Application . StartupPath . ToLower ( ) ) )
792+ {
793+ // check added because a succesful Update operation will empty the Open Rails folder and lose any content stored within it.
794+ MessageBox . Show ( catalog . GetString
795+ ( $ "Cannot use content from any folder which lies inside the Open Rails program folder { Application . StartupPath } \n \n ")
796+ , "Invalid content location"
797+ , MessageBoxButtons . OK
798+ , MessageBoxIcon . Error ) ;
799+ return true ;
800+ }
801+
802+ return false ;
803+ }
804+
795805 #region Help for Options
796806 // The icons all share the same code which assumes they are named according to a simple scheme as follows:
797807 // 1. To add a new Help Icon, copy an existing one and paste it onto the tab.
0 commit comments