fixed #343: Actions output can end with text instead only extension

This commit is contained in:
Jaex 2014-10-19 11:48:10 +03:00
parent efc8b69d26
commit 56a3068ec9
2 changed files with 18 additions and 4 deletions

View file

@ -53,7 +53,7 @@ public static string GetDescription(this Enum value)
public static string GetLocalizedDescription(this Enum value, ResourceManager resourceManager)
{
string resourceName = value.GetType() + "_" + value;
string resourceName = value.GetType().Name + "_" + value;
string description = resourceManager.GetString(resourceName);
if (string.IsNullOrEmpty(description))

View file

@ -68,13 +68,15 @@ public string Run(string filePath)
try
{
string newFilePath = "";
using (Process process = new Process())
{
ProcessStartInfo psi = new ProcessStartInfo(Path);
if (string.IsNullOrEmpty(Args))
{
psi.Arguments = filePath;
psi.Arguments = '"' + filePath + '"';
}
else
{
@ -82,8 +84,15 @@ public string Run(string filePath)
if (!string.IsNullOrEmpty(OutputExtension))
{
filePath = Helpers.ChangeFilenameExtension(filePath, OutputExtension);
args = args.Replace("%output", '"' + filePath + '"');
newFilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(filePath), System.IO.Path.GetFileNameWithoutExtension(filePath));
if (!OutputExtension.Contains("."))
{
OutputExtension = "." + OutputExtension;
}
newFilePath += OutputExtension;
args = args.Replace("%output", '"' + newFilePath + '"');
}
psi.Arguments = args;
@ -97,6 +106,11 @@ public string Run(string filePath)
process.WaitForExit();
}
if (!string.IsNullOrEmpty(newFilePath) && File.Exists(newFilePath))
{
return newFilePath;
}
return filePath;
}
catch (Exception e)