Skip to content

Commit 85b80bf

Browse files
committed
fix for #36
1 parent 13019b9 commit 85b80bf

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ElectronNET.CLI/Commands/StartElectronCommand.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
5+
using System.Runtime.InteropServices;
56
using System.Threading.Tasks;
67

78
namespace ElectronNET.CLI.Commands
89
{
910
public class StartElectronCommand : ICommand
1011
{
1112
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.";
1314
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
1415
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
1516

@@ -75,9 +76,18 @@ public Task<bool> ExecuteAsync()
7576
ProcessHelper.CmdExecute("npm install", tempPath);
7677

7778
string path = Path.Combine(tempPath, "node_modules", ".bin");
78-
Console.WriteLine("Invoke electron.cmd - in dir: " + path);
7979

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+
}
8191

8292
return true;
8393
});

0 commit comments

Comments
 (0)