mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
BUG-2114: Fixed totaly f***ed up fix, this should be better.
This commit is contained in:
parent
89ae9489d2
commit
9e9d058fdc
3 changed files with 26 additions and 12 deletions
|
@ -115,11 +115,7 @@ namespace Greenshot.Destinations {
|
||||||
pattern = "greenshot ${capturetime}";
|
pattern = "greenshot ${capturetime}";
|
||||||
}
|
}
|
||||||
string filename = FilenameHelper.GetFilenameFromPattern(pattern, CoreConfig.OutputFileFormat, captureDetails);
|
string filename = FilenameHelper.GetFilenameFromPattern(pattern, CoreConfig.OutputFileFormat, captureDetails);
|
||||||
// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
|
CoreConfig.ValidateAndCorrectOutputFilePath();
|
||||||
if (!File.Exists(CoreConfig.OutputFilePath))
|
|
||||||
{
|
|
||||||
CoreConfig.OutputFilePath = CoreConfig.GetDefault(nameof(CoreConfig.OutputFilePath)) as string;
|
|
||||||
}
|
|
||||||
string filepath = FilenameHelper.FillVariables(CoreConfig.OutputFilePath, false);
|
string filepath = FilenameHelper.FillVariables(CoreConfig.OutputFilePath, false);
|
||||||
try {
|
try {
|
||||||
fullPath = Path.Combine(filepath, filename);
|
fullPath = Path.Combine(filepath, filename);
|
||||||
|
|
|
@ -68,13 +68,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
ApplyFilterOptions();
|
ApplyFilterOptions();
|
||||||
string initialDirectory = null;
|
string initialDirectory = null;
|
||||||
try {
|
try {
|
||||||
// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
|
conf.ValidateAndCorrectOutputFileAsFullpath();
|
||||||
var outputFilePath = Path.GetDirectoryName(conf.OutputFileAsFullpath);
|
|
||||||
if (outputFilePath == null || (!File.Exists(conf.OutputFileAsFullpath) && !Directory.Exists(outputFilePath)))
|
|
||||||
{
|
|
||||||
conf.OutputFileAsFullpath = conf.GetDefault(nameof(conf.OutputFileAsFullpath)) as string;
|
|
||||||
}
|
|
||||||
|
|
||||||
initialDirectory = Path.GetDirectoryName(conf.OutputFileAsFullpath);
|
initialDirectory = Path.GetDirectoryName(conf.OutputFileAsFullpath);
|
||||||
} catch {
|
} catch {
|
||||||
LOG.WarnFormat("OutputFileAsFullpath was set to {0}, ignoring due to problem in path.", conf.OutputFileAsFullpath);
|
LOG.WarnFormat("OutputFileAsFullpath was set to {0}, ignoring due to problem in path.", conf.OutputFileAsFullpath);
|
||||||
|
|
|
@ -515,5 +515,29 @@ namespace GreenshotPlugin.Core {
|
||||||
WebRequestReadWriteTimeout = 100;
|
WebRequestReadWriteTimeout = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate the OutputFilePath, and if this is not correct it will be set to the default
|
||||||
|
/// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
|
||||||
|
/// </summary>
|
||||||
|
public void ValidateAndCorrectOutputFilePath()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(OutputFilePath))
|
||||||
|
{
|
||||||
|
OutputFilePath = GetDefault(nameof(OutputFilePath)) as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Validate the OutputFileAsFullpath, and if this is not correct it will be set to the default
|
||||||
|
/// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
|
||||||
|
/// </summary>
|
||||||
|
public void ValidateAndCorrectOutputFileAsFullpath()
|
||||||
|
{
|
||||||
|
var outputFilePath = Path.GetDirectoryName(OutputFileAsFullpath);
|
||||||
|
if (outputFilePath == null || (!File.Exists(OutputFileAsFullpath) && !Directory.Exists(outputFilePath)))
|
||||||
|
{
|
||||||
|
OutputFileAsFullpath = GetDefault(nameof(OutputFileAsFullpath)) as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue