@@ -53,30 +53,20 @@ public static class ConsoleController
53
53
54
54
public static void Init ( )
55
55
{
56
+ // Make sure console is supported on this platform
56
57
try
57
58
{
58
59
ResetConsole ( false ) ;
59
60
// ensure the compiler is supported (if this fails then SRE is probably stubbed)
60
61
Evaluator . Compile ( "0 == 0" ) ;
61
-
62
- if ( ! Directory . Exists ( ScriptsFolder ) )
63
- Directory . CreateDirectory ( ScriptsFolder ) ;
64
-
65
- var startupPath = Path . Combine ( ScriptsFolder , "startup.cs" ) ;
66
- if ( File . Exists ( startupPath ) )
67
- {
68
- ExplorerCore . Log ( $ "Executing startup script from '{ startupPath } '...") ;
69
- var text = File . ReadAllText ( startupPath ) ;
70
- Input . Text = text ;
71
- Evaluate ( ) ;
72
- }
73
62
}
74
63
catch ( Exception ex )
75
64
{
76
65
DisableConsole ( ex ) ;
77
66
return ;
78
67
}
79
68
69
+ // Setup console
80
70
Lexer = new LexerBuilder ( ) ;
81
71
Completer = new CSAutoCompleter ( ) ;
82
72
@@ -90,6 +80,26 @@ public static void Init()
90
80
Panel . OnAutoIndentToggled += OnToggleAutoIndent ;
91
81
Panel . OnCtrlRToggled += OnToggleCtrlRShortcut ;
92
82
Panel . OnSuggestionsToggled += OnToggleSuggestions ;
83
+
84
+ // Run startup script
85
+ try
86
+ {
87
+ if ( ! Directory . Exists ( ScriptsFolder ) )
88
+ Directory . CreateDirectory ( ScriptsFolder ) ;
89
+
90
+ var startupPath = Path . Combine ( ScriptsFolder , "startup.cs" ) ;
91
+ if ( File . Exists ( startupPath ) )
92
+ {
93
+ ExplorerCore . Log ( $ "Executing startup script from '{ startupPath } '...") ;
94
+ var text = File . ReadAllText ( startupPath ) ;
95
+ Input . Text = text ;
96
+ Evaluate ( ) ;
97
+ }
98
+ }
99
+ catch ( Exception ex )
100
+ {
101
+ ExplorerCore . LogWarning ( $ "Exception executing startup script: { ex } ") ;
102
+ }
93
103
}
94
104
95
105
0 commit comments