Skip to content

Commit

Permalink
Fix path to ANT when spaces are present.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neverbirth committed Jul 20, 2016
1 parent 7cdeca2 commit a2e7a49
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions AntPanel/PluginMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace AntPanel
{
public class PluginMain : IPlugin
{
{
public readonly List<string> BuildFilesList = new List<string>();
public string StorageFileName => "antPanelData.txt";
string settingFilename;
Expand All @@ -25,7 +25,7 @@ public class PluginMain : IPlugin
DockContent pluginPanel;
TreeView projectTree;

#region Required Properties
#region Required Properties

/// <summary>
/// Api level of the plugin
Expand Down Expand Up @@ -62,27 +62,27 @@ public class PluginMain : IPlugin
/// </summary>
[Browsable(false)]
public object Settings { get; private set; }
#endregion
#region Required Methods
/// <summary>
/// Initializes the plugin
/// </summary>
public void Initialize()
{
#endregion
#region Required Methods
/// <summary>
/// Initializes the plugin
/// </summary>
public void Initialize()
{
InitBasics();
LoadSettings();
AddEventHandlers();
CreateMenuItem();
CreatePluginPanel();
CreatePluginPanel();
}

/// <summary>
/// Disposes the plugin
/// </summary>
public void Dispose() => SaveSettings();
/// <summary>
/// Disposes the plugin
/// </summary>
public void Dispose() => SaveSettings();

/// <summary>
/// Adds the required event handlers
Expand All @@ -93,7 +93,7 @@ public void Initialize()
/// Handles the incoming events
/// </summary>
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
{
{
switch (e.Type)
{
case EventType.UIStarted:
Expand All @@ -113,37 +113,37 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority)
}
break;
}
}
}

#endregion

#region Custom Public Methods

public void AddBuildFiles(IEnumerable<string> files)
public void AddBuildFiles(IEnumerable<string> files)
{
foreach (var file in files.Where(file => !BuildFilesList.Contains(file)))
BuildFilesList.Add(file);
SaveBuildFiles();
foreach (var file in files.Where(file => !BuildFilesList.Contains(file)))
BuildFilesList.Add(file);
SaveBuildFiles();
pluginUI.RefreshData();
}

public void RemoveBuildFile(string file)
public void RemoveBuildFile(string file)
{
if (BuildFilesList.Contains(file)) BuildFilesList.Remove(file);
SaveBuildFiles();
pluginUI.RefreshData();
}

public void RunTarget(string file, string target)
public void RunTarget(string file, string target)
{
var antPath = ((Settings)Settings).AntPath;
var addArgs = ((Settings)Settings).AdditionalArgs;
var antPath = ((Settings)Settings).AntPath;
var addArgs = ((Settings)Settings).AdditionalArgs;
var command = /*PluginBase.MainForm.CommandPromptExecutable ??*/ Path.Combine(Environment.SystemDirectory, "cmd.exe");
var arguments = "/c ";
var arguments = "/c \"";
if (string.IsNullOrEmpty(antPath)) arguments += "ant";
else arguments += Path.Combine(Path.Combine(antPath, "bin"), "ant");
if (!string.IsNullOrEmpty(addArgs)) arguments += " " + addArgs;
arguments += $" -buildfile \"{file}\" \"{target}\"";
else arguments += "\"" + Path.Combine(Path.Combine(antPath, "bin"), "ant") + "\"";
if (!string.IsNullOrEmpty(addArgs)) arguments += " " + addArgs;
arguments += $" -buildfile \"{file}\" \"{target}\"\"";
PluginBase.MainForm.CallCommand("RunProcessCaptured", $"{command};{arguments}");
}

Expand Down Expand Up @@ -197,7 +197,7 @@ void CreatePluginPanel()
pluginPanel = PluginBase.MainForm.CreateDockablePanel(pluginUI, Guid, pluginImage, DockState.DockRight);
}

/// <summary>
/// <summary>
/// Loads the plugin settings
/// </summary>
void LoadSettings()
Expand Down

0 comments on commit a2e7a49

Please sign in to comment.