mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 14:24:43 -07:00
BUG-2114 & BUG-1992: Hopefully implemented this more stable as it used to be.
This commit is contained in:
parent
73bdd0f405
commit
0b2cbe1c0b
4 changed files with 43 additions and 16 deletions
|
@ -68,6 +68,12 @@ namespace GreenshotPlugin.Controls {
|
|||
ApplyFilterOptions();
|
||||
string initialDirectory = null;
|
||||
try {
|
||||
// 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))
|
||||
{
|
||||
conf.OutputFileAsFullpath = conf.GetDefault(nameof(conf.OutputFileAsFullpath)) as string;
|
||||
}
|
||||
|
||||
initialDirectory = Path.GetDirectoryName(conf.OutputFileAsFullpath);
|
||||
} catch {
|
||||
LOG.WarnFormat("OutputFileAsFullpath was set to {0}, ignoring due to problem in path.", conf.OutputFileAsFullpath);
|
||||
|
@ -90,12 +96,12 @@ namespace GreenshotPlugin.Controls {
|
|||
PrepareFilterOptions();
|
||||
string fdf = "";
|
||||
int preselect = 0;
|
||||
var outputFileFormatAsString = Enum.GetName(typeof(OutputFormat), conf.OutputFileFormat);
|
||||
var outputFileFormatAsString = Enum.GetName(typeof(OutputFormat), conf.OutputFileFormat);
|
||||
for(int i=0; i<_filterOptions.Length; i++){
|
||||
FilterOption fo = _filterOptions[i];
|
||||
fdf += fo.Label + "|*." + fo.Extension + "|";
|
||||
if(outputFileFormatAsString == fo.Extension)
|
||||
preselect = i;
|
||||
if(outputFileFormatAsString == fo.Extension)
|
||||
preselect = i;
|
||||
}
|
||||
fdf = fdf.Substring(0, fdf.Length-1);
|
||||
SaveFileDialog.Filter = fdf;
|
||||
|
|
|
@ -342,9 +342,8 @@ namespace GreenshotPlugin.Core {
|
|||
case "OutputFileAsFullpath":
|
||||
if (IniConfig.IsPortable) {
|
||||
return Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots\dummy.png");
|
||||
} else {
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),"dummy.png");
|
||||
}
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),"dummy.png");
|
||||
case "OutputFilePath":
|
||||
if (IniConfig.IsPortable) {
|
||||
string pafOutputFilePath = Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots");
|
||||
|
@ -515,16 +514,6 @@ namespace GreenshotPlugin.Core {
|
|||
if (WebRequestReadWriteTimeout < 1) {
|
||||
WebRequestReadWriteTimeout = 100;
|
||||
}
|
||||
|
||||
// Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is used on a different PC)
|
||||
if (!Directory.Exists(OutputFilePath))
|
||||
{
|
||||
OutputFilePath = GetDefault(nameof(OutputFilePath)) as string;
|
||||
}
|
||||
if (!File.Exists(OutputFileAsFullpath))
|
||||
{
|
||||
OutputFileAsFullpath = GetDefault(nameof(OutputFileAsFullpath)) as string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue