mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -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
|
@ -115,6 +115,11 @@ namespace Greenshot.Destinations {
|
|||
pattern = "greenshot ${capturetime}";
|
||||
}
|
||||
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)
|
||||
if (!File.Exists(CoreConfig.OutputFilePath))
|
||||
{
|
||||
CoreConfig.OutputFilePath = CoreConfig.GetDefault(nameof(CoreConfig.OutputFilePath)) as string;
|
||||
}
|
||||
string filepath = FilenameHelper.FillVariables(CoreConfig.OutputFilePath, false);
|
||||
try {
|
||||
fullPath = Path.Combine(filepath, filename);
|
||||
|
|
|
@ -1307,6 +1307,11 @@ namespace Greenshot {
|
|||
private void NotifyIconClick(ClickActions clickAction) {
|
||||
switch (clickAction) {
|
||||
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)
|
||||
if (!File.Exists(_conf.OutputFileAsFullpath))
|
||||
{
|
||||
_conf.OutputFileAsFullpath = _conf.GetDefault(nameof(_conf.OutputFileAsFullpath)) as string;
|
||||
}
|
||||
string path = _conf.OutputFileAsFullpath;
|
||||
if (!File.Exists(path)) {
|
||||
string lastFilePath = Path.GetDirectoryName(_conf.OutputFileAsFullpath);
|
||||
|
@ -1315,15 +1320,25 @@ namespace Greenshot {
|
|||
}
|
||||
}
|
||||
if (path == null) {
|
||||
// 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.OutputFilePath))
|
||||
{
|
||||
_conf.OutputFilePath = _conf.GetDefault(nameof(_conf.OutputFilePath)) as string;
|
||||
}
|
||||
string configPath = FilenameHelper.FillVariables(_conf.OutputFilePath, false);
|
||||
if (Directory.Exists(configPath)) {
|
||||
path = configPath;
|
||||
}
|
||||
}
|
||||
|
||||
ExplorerHelper.OpenInExplorer(path);
|
||||
break;
|
||||
case ClickActions.OPEN_LAST_IN_EDITOR:
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (File.Exists(_conf.OutputFileAsFullpath)) {
|
||||
CaptureHelper.CaptureFile(_conf.OutputFileAsFullpath, DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
|
||||
}
|
||||
|
@ -1342,9 +1357,21 @@ namespace Greenshot {
|
|||
/// The Contextmenu_OpenRecent currently opens the last know save location
|
||||
/// </summary>
|
||||
private void Contextmenu_OpenRecent(object sender, EventArgs eventArgs) {
|
||||
// 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.OutputFilePath))
|
||||
{
|
||||
_conf.OutputFilePath = _conf.GetDefault(nameof(_conf.OutputFilePath)) as string;
|
||||
}
|
||||
|
||||
string path = FilenameHelper.FillVariables(_conf.OutputFilePath, false);
|
||||
// Fix for #1470, problems with a drive which is no longer available
|
||||
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;
|
||||
}
|
||||
|
||||
string lastFilePath = Path.GetDirectoryName(_conf.OutputFileAsFullpath);
|
||||
|
||||
if (lastFilePath != null && Directory.Exists(lastFilePath)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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