mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +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)
|
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);
|
string description = resourceManager.GetString(resourceName);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(description))
|
if (string.IsNullOrEmpty(description))
|
||||||
|
|
|
@ -68,13 +68,15 @@ public string Run(string filePath)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
string newFilePath = "";
|
||||||
|
|
||||||
using (Process process = new Process())
|
using (Process process = new Process())
|
||||||
{
|
{
|
||||||
ProcessStartInfo psi = new ProcessStartInfo(Path);
|
ProcessStartInfo psi = new ProcessStartInfo(Path);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Args))
|
if (string.IsNullOrEmpty(Args))
|
||||||
{
|
{
|
||||||
psi.Arguments = filePath;
|
psi.Arguments = '"' + filePath + '"';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -82,8 +84,15 @@ public string Run(string filePath)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(OutputExtension))
|
if (!string.IsNullOrEmpty(OutputExtension))
|
||||||
{
|
{
|
||||||
filePath = Helpers.ChangeFilenameExtension(filePath, OutputExtension);
|
newFilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(filePath), System.IO.Path.GetFileNameWithoutExtension(filePath));
|
||||||
args = args.Replace("%output", '"' + filePath + '"');
|
|
||||||
|
if (!OutputExtension.Contains("."))
|
||||||
|
{
|
||||||
|
OutputExtension = "." + OutputExtension;
|
||||||
|
}
|
||||||
|
|
||||||
|
newFilePath += OutputExtension;
|
||||||
|
args = args.Replace("%output", '"' + newFilePath + '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
psi.Arguments = args;
|
psi.Arguments = args;
|
||||||
|
@ -97,6 +106,11 @@ public string Run(string filePath)
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(newFilePath) && File.Exists(newFilePath))
|
||||||
|
{
|
||||||
|
return newFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Reference in a new issue