mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
fixed #343: Actions output can end with text instead only extension
This commit is contained in:
parent
efc8b69d26
commit
56a3068ec9
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue