mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 17:13:44 -07:00
Added tmp-file cleanup, including the cached entry, currently only for Excel.
This commit is contained in:
parent
1c0dc61bd8
commit
fa79ebb727
2 changed files with 21 additions and 2 deletions
|
@ -124,8 +124,8 @@ namespace GreenshotOfficePlugin {
|
||||||
exportInformation.ExportMade = true;
|
exportInformation.ExportMade = true;
|
||||||
ProcessExport(exportInformation, surface);
|
ProcessExport(exportInformation, surface);
|
||||||
// Cleanup imageFile if we created it here, so less tmp-files are generated and left
|
// Cleanup imageFile if we created it here, so less tmp-files are generated and left
|
||||||
if (createdFile && File.Exists(imageFile)) {
|
if (createdFile) {
|
||||||
File.Delete(imageFile);
|
ImageOutput.DeleteNamedTmpFile(imageFile);
|
||||||
}
|
}
|
||||||
return exportInformation;
|
return exportInformation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,6 +541,25 @@ namespace GreenshotPlugin.Core {
|
||||||
return tmpFile;
|
return tmpFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove a tmpfile which was created by SaveNamedTmpFile
|
||||||
|
/// Used e.g. by the email export
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tmpfile"></param>
|
||||||
|
/// <returns>true if it worked</returns>
|
||||||
|
public static bool DeleteNamedTmpFile(string tmpfile) {
|
||||||
|
LOG.Debug("Deleting TMP File: " + tmpfile);
|
||||||
|
try {
|
||||||
|
if (File.Exists(tmpfile)) {
|
||||||
|
File.Delete(tmpfile);
|
||||||
|
tmpFileCache.Remove(tmpfile);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to create a temp image file
|
/// Helper method to create a temp image file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue