mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-29 16:51:18 +13:00
[BUG] Fix FileNotFoundException - Option GenerateDriveShortcuts - in case Windows Defender triggered (#272), version 1.2.0.3
This commit is contained in:
parent
6d3832521f
commit
401e1329f1
1 changed files with 10 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
namespace SystemTrayMenu.Utilities
|
namespace SystemTrayMenu.Utilities
|
||||||
{
|
{
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -39,8 +40,16 @@ namespace SystemTrayMenu.Utilities
|
||||||
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(linkPath);
|
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(linkPath);
|
||||||
shortcut.Description = "Generated by SystemTrayMenu";
|
shortcut.Description = "Generated by SystemTrayMenu";
|
||||||
shortcut.TargetPath = targetPath;
|
shortcut.TargetPath = targetPath;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
shortcut.Save();
|
shortcut.Save();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warn($"Could not create shortcut at path:'{linkPath}'", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetLinkPathFromDriveName(string driveName)
|
private static string GetLinkPathFromDriveName(string driveName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue