BUG-2095: Improved the validity check of the OutputFileAsFullpath setting, this should prevent a reset if only the file is not available.

This commit is contained in:
Robin 2017-01-14 20:18:04 +01:00
parent 25d9c17bed
commit c77e77578d
2 changed files with 6 additions and 3 deletions

View file

@ -1308,7 +1308,8 @@ namespace Greenshot {
switch (clickAction) { switch (clickAction) {
case ClickActions.OPEN_LAST_IN_EXPLORER: case ClickActions.OPEN_LAST_IN_EXPLORER:
// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC) // Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
if (!File.Exists(_conf.OutputFileAsFullpath)) var outputFilePath = Path.GetDirectoryName(_conf.OutputFileAsFullpath);
if (outputFilePath == null || (!File.Exists(_conf.OutputFileAsFullpath) && !Directory.Exists(Path.GetDirectoryName(outputFilePath))))
{ {
_conf.OutputFileAsFullpath = _conf.GetDefault(nameof(_conf.OutputFileAsFullpath)) as string; _conf.OutputFileAsFullpath = _conf.GetDefault(nameof(_conf.OutputFileAsFullpath)) as string;
} }
@ -1367,7 +1368,8 @@ namespace Greenshot {
// Fix for #1470, problems with a drive which is no longer available // Fix for #1470, problems with a drive which is no longer available
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) // Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
if (!File.Exists(_conf.OutputFileAsFullpath)) var outputFilePath = Path.GetDirectoryName(_conf.OutputFileAsFullpath);
if (outputFilePath == null || (!File.Exists(_conf.OutputFileAsFullpath) && !Directory.Exists(Path.GetDirectoryName(outputFilePath))))
{ {
_conf.OutputFileAsFullpath = _conf.GetDefault(nameof(_conf.OutputFileAsFullpath)) as string; _conf.OutputFileAsFullpath = _conf.GetDefault(nameof(_conf.OutputFileAsFullpath)) as string;
} }

View file

@ -69,7 +69,8 @@ namespace GreenshotPlugin.Controls {
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) // Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
if (!File.Exists(conf.OutputFileAsFullpath)) 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; conf.OutputFileAsFullpath = conf.GetDefault(nameof(conf.OutputFileAsFullpath)) as string;
} }