Skip to content

Commit 7d6d793

Browse files
committed
- Added support for custom script (F5) launcher. The launcher path is to be set from the settings dialog.
1 parent 24591a4 commit 7d6d793

File tree

13 files changed

+106
-35
lines changed

13 files changed

+106
-35
lines changed
512 Bytes
Binary file not shown.

src/CSScriptNpp/CSScriptNpp/CSScriptHelper.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,26 @@ static public void Execute(string scriptFile, Action<Process> onStart = null, Ac
408408
{
409409
var p = new Process();
410410
p.StartInfo.FileName = cscs_exe;
411+
412+
if (!Config.Instance.UseCustomLauncher.IsEmpty())
413+
{
414+
try
415+
{
416+
var exe = Environment.ExpandEnvironmentVariables(Config.Instance.UseCustomLauncher);
417+
if (File.Exists(exe))
418+
p.StartInfo.FileName = exe;
419+
else
420+
throw new Exception();
421+
}
422+
catch
423+
{
424+
MessageBox.Show($"The custom launcher (\"{Config.Instance.UseCustomLauncher}\") cannot be found.\n" +
425+
$"Using default launcher instead.\n\n" +
426+
$"Please update its location in the settings dialog",
427+
"CS-Script");
428+
}
429+
}
430+
411431
p.StartInfo.Arguments = "-l -d " + GenerateDefaultArgs(scriptFile) + " \"" + scriptFile + "\"";
412432

413433
bool needsElevation = !RunningAsAdmin && IsAsAdminScriptFile(scriptFile);
@@ -948,7 +968,7 @@ static public string Isolate(string scriptFile, bool asScript, string targerRunt
948968
}
949969
else
950970
{
951-
string srcBinary = Path.ChangeExtension(scriptFile, asDll? ".dll": ".exe");
971+
string srcBinary = Path.ChangeExtension(scriptFile, asDll ? ".dll" : ".exe");
952972
string destBinary = Path.Combine(dir, Path.GetFileName(srcBinary));
953973

954974
string script = "\"" + scriptFile + "\"";
0 Bytes
Binary file not shown.

src/CSScriptNpp/CSScriptNpp/Config.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public string GetFileName()
6060
public bool UseRoslynProvider = true;
6161
public bool VbSupportEnabled = true;
6262
public bool RestorePanelsAtStartup = true;
63+
public string UseCustomLauncher = "";
6364
public bool StartRoslynServerAtNppStartup = true;
6465
public bool ImproveWin10ListVeiwRendering = true;
6566
public bool HideDevaultAssemblies = true;
@@ -154,6 +155,7 @@ public void Save()
154155
SetValue(Section, nameof(ImproveWin10ListVeiwRendering), ImproveWin10ListVeiwRendering);
155156
SetValue(Section, nameof(HideDevaultAssemblies), HideDevaultAssemblies);
156157
SetValue(Section, nameof(RestorePanelsAtStartup), RestorePanelsAtStartup);
158+
SetValue(Section, nameof(UseCustomLauncher), UseCustomLauncher);
157159
SetValue(Section, nameof(UpdateMode), UpdateMode);
158160
SetValue(Section, nameof(VSProjectTemplatePath), VSProjectTemplatePath);
159161
SetValue(Section, nameof(FloatingPanelsWarningAlreadyPropted), FloatingPanelsWarningAlreadyPropted);
@@ -237,6 +239,7 @@ public void Open()
237239
UseRoslynProvider = GetValue(Section, nameof(UseRoslynProvider), UseRoslynProvider);
238240
StartRoslynServerAtNppStartup = GetValue(Section, nameof(StartRoslynServerAtNppStartup), StartRoslynServerAtNppStartup);
239241
RestorePanelsAtStartup = GetValue(Section, nameof(RestorePanelsAtStartup), RestorePanelsAtStartup);
242+
UseCustomLauncher = GetValue(Section, nameof(UseCustomLauncher), UseCustomLauncher);
240243
ImproveWin10ListVeiwRendering = GetValue(Section, nameof(ImproveWin10ListVeiwRendering), ImproveWin10ListVeiwRendering);
241244
HideDevaultAssemblies = GetValue(Section, nameof(HideDevaultAssemblies), HideDevaultAssemblies);
242245
UpdateMode = GetValue(Section, nameof(UpdateMode), UpdateMode);
2.5 KB
Binary file not shown.
1.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1 KB
Binary file not shown.

0 commit comments

Comments
 (0)