Modify for read only lnk check. Should be sufficient

This commit is contained in:
Travis Nickles 2019-11-04 01:08:05 -06:00
parent c1746410dc
commit 9d2ded0606

View File

@ -346,15 +346,15 @@ namespace DS4Windows.Forms
if (onlylnkpath != Process.GetCurrentProcess().MainModule.FileName) if (onlylnkpath != Process.GetCurrentProcess().MainModule.FileName)
{ {
try string ds4lnkpath = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk";
if (!new FileInfo(ds4lnkpath).IsReadOnly)
{ {
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"); File.Delete(ds4lnkpath);
appShortcutToStartup(); appShortcutToStartup();
changeStartupRoutine(); changeStartupRoutine();
} }
catch else
{ {
MessageBox.Show("No access to Autorun/DS4Windows.lnk\nPlease check file permissions", "DS4Windows");
StartWindowsCheckBox.Checked = false; StartWindowsCheckBox.Checked = false;
runStartupPanel.Visible = false; runStartupPanel.Visible = false;
} }