mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Improve action debug output
This commit is contained in:
parent
a8f106348e
commit
3c7d6b264a
2 changed files with 17 additions and 1 deletions
|
@ -104,14 +104,18 @@ public string Run(string inputPath)
|
|||
CreateNoWindow = HiddenWindow
|
||||
};
|
||||
|
||||
DebugHelper.WriteLine($"Action input: \"{inputPath}\" ({Helpers.GetFileSizeReadable(inputPath)})");
|
||||
DebugHelper.WriteLine($"Action run: \"{psi.FileName}\" {psi.Arguments}");
|
||||
|
||||
process.StartInfo = psi;
|
||||
DebugHelper.WriteLine($"CLI: \"{psi.FileName}\" {psi.Arguments}");
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(outputPath) && File.Exists(outputPath))
|
||||
{
|
||||
DebugHelper.WriteLine($"Action output: \"{outputPath}\" ({Helpers.GetFileSizeReadable(outputPath)})");
|
||||
|
||||
if (DeleteInputFile && !inputPath.Equals(outputPath, StringComparison.OrdinalIgnoreCase) && File.Exists(inputPath))
|
||||
{
|
||||
DebugHelper.WriteLine("Deleting input file: " + inputPath);
|
||||
|
|
|
@ -940,6 +940,18 @@ public static long GetFileSize(string filePath)
|
|||
return -1;
|
||||
}
|
||||
|
||||
public static string GetFileSizeReadable(string filePath, bool binaryUnits = false)
|
||||
{
|
||||
long fileSize = GetFileSize(filePath);
|
||||
|
||||
if (fileSize >= 0)
|
||||
{
|
||||
return fileSize.ToSizeString(binaryUnits);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void CreateDirectory(string directoryPath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
|
||||
|
|
Loading…
Reference in a new issue