|
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Diagnostics; |
4 | 4 | using System.IO; |
| 5 | +using System.Runtime.InteropServices; |
5 | 6 | using System.Threading.Tasks; |
6 | 7 |
|
7 | 8 | namespace ElectronNET.CLI.Commands |
8 | 9 | { |
9 | 10 | public class StartElectronCommand : ICommand |
10 | 11 | { |
11 | 12 | public const string COMMAND_NAME = "start"; |
12 | | - public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron."; |
| 13 | + public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron, without package it as a single exe. Faster for development."; |
13 | 14 | public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project."; |
14 | 15 | public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>(); |
15 | 16 |
|
@@ -75,9 +76,18 @@ public Task<bool> ExecuteAsync() |
75 | 76 | ProcessHelper.CmdExecute("npm install", tempPath); |
76 | 77 |
|
77 | 78 | string path = Path.Combine(tempPath, "node_modules", ".bin"); |
78 | | - Console.WriteLine("Invoke electron.cmd - in dir: " + path); |
79 | 79 |
|
80 | | - ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", path); |
| 80 | + bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); |
| 81 | + if (isWindows) |
| 82 | + { |
| 83 | + Console.WriteLine("Invoke electron.cmd - in dir: " + path); |
| 84 | + ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", path); |
| 85 | + } |
| 86 | + else |
| 87 | + { |
| 88 | + Console.WriteLine("Invoke electron - in dir: " + path); |
| 89 | + ProcessHelper.CmdExecute(@"electron ""..\..\main.js""", path); |
| 90 | + } |
81 | 91 |
|
82 | 92 | return true; |
83 | 93 | }); |
|
0 commit comments