Skip to content

Commit 2207070

Browse files
author
SlavaRa
authored
Merge pull request #36 from Neverbirth/master
Fix path to ANT when spaces are present.
2 parents 7cdeca2 + a2e7a49 commit 2207070

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

AntPanel/PluginMain.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace AntPanel
1717
{
1818
public class PluginMain : IPlugin
19-
{
19+
{
2020
public readonly List<string> BuildFilesList = new List<string>();
2121
public string StorageFileName => "antPanelData.txt";
2222
string settingFilename;
@@ -25,7 +25,7 @@ public class PluginMain : IPlugin
2525
DockContent pluginPanel;
2626
TreeView projectTree;
2727

28-
#region Required Properties
28+
#region Required Properties
2929

3030
/// <summary>
3131
/// Api level of the plugin
@@ -62,27 +62,27 @@ public class PluginMain : IPlugin
6262
/// </summary>
6363
[Browsable(false)]
6464
public object Settings { get; private set; }
65-
66-
#endregion
67-
68-
#region Required Methods
69-
70-
/// <summary>
71-
/// Initializes the plugin
72-
/// </summary>
73-
public void Initialize()
74-
{
65+
66+
#endregion
67+
68+
#region Required Methods
69+
70+
/// <summary>
71+
/// Initializes the plugin
72+
/// </summary>
73+
public void Initialize()
74+
{
7575
InitBasics();
7676
LoadSettings();
7777
AddEventHandlers();
7878
CreateMenuItem();
79-
CreatePluginPanel();
79+
CreatePluginPanel();
8080
}
8181

82-
/// <summary>
83-
/// Disposes the plugin
84-
/// </summary>
85-
public void Dispose() => SaveSettings();
82+
/// <summary>
83+
/// Disposes the plugin
84+
/// </summary>
85+
public void Dispose() => SaveSettings();
8686

8787
/// <summary>
8888
/// Adds the required event handlers
@@ -93,7 +93,7 @@ public void Initialize()
9393
/// Handles the incoming events
9494
/// </summary>
9595
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
96-
{
96+
{
9797
switch (e.Type)
9898
{
9999
case EventType.UIStarted:
@@ -113,37 +113,37 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
113113
}
114114
break;
115115
}
116-
}
116+
}
117117

118118
#endregion
119119

120120
#region Custom Public Methods
121121

122-
public void AddBuildFiles(IEnumerable<string> files)
122+
public void AddBuildFiles(IEnumerable<string> files)
123123
{
124-
foreach (var file in files.Where(file => !BuildFilesList.Contains(file)))
125-
BuildFilesList.Add(file);
126-
SaveBuildFiles();
124+
foreach (var file in files.Where(file => !BuildFilesList.Contains(file)))
125+
BuildFilesList.Add(file);
126+
SaveBuildFiles();
127127
pluginUI.RefreshData();
128128
}
129129

130-
public void RemoveBuildFile(string file)
130+
public void RemoveBuildFile(string file)
131131
{
132132
if (BuildFilesList.Contains(file)) BuildFilesList.Remove(file);
133133
SaveBuildFiles();
134134
pluginUI.RefreshData();
135135
}
136136

137-
public void RunTarget(string file, string target)
137+
public void RunTarget(string file, string target)
138138
{
139-
var antPath = ((Settings)Settings).AntPath;
140-
var addArgs = ((Settings)Settings).AdditionalArgs;
139+
var antPath = ((Settings)Settings).AntPath;
140+
var addArgs = ((Settings)Settings).AdditionalArgs;
141141
var command = /*PluginBase.MainForm.CommandPromptExecutable ??*/ Path.Combine(Environment.SystemDirectory, "cmd.exe");
142-
var arguments = "/c ";
142+
var arguments = "/c \"";
143143
if (string.IsNullOrEmpty(antPath)) arguments += "ant";
144-
else arguments += Path.Combine(Path.Combine(antPath, "bin"), "ant");
145-
if (!string.IsNullOrEmpty(addArgs)) arguments += " " + addArgs;
146-
arguments += $" -buildfile \"{file}\" \"{target}\"";
144+
else arguments += "\"" + Path.Combine(Path.Combine(antPath, "bin"), "ant") + "\"";
145+
if (!string.IsNullOrEmpty(addArgs)) arguments += " " + addArgs;
146+
arguments += $" -buildfile \"{file}\" \"{target}\"\"";
147147
PluginBase.MainForm.CallCommand("RunProcessCaptured", $"{command};{arguments}");
148148
}
149149

@@ -197,7 +197,7 @@ void CreatePluginPanel()
197197
pluginPanel = PluginBase.MainForm.CreateDockablePanel(pluginUI, Guid, pluginImage, DockState.DockRight);
198198
}
199199

200-
/// <summary>
200+
/// <summary>
201201
/// Loads the plugin settings
202202
/// </summary>
203203
void LoadSettings()

0 commit comments

Comments
 (0)