From e3ee633cb9227d203d0900dc83ef78109d3264c5 Mon Sep 17 00:00:00 2001 From: Eusebiu Marcu Date: Wed, 10 Aug 2011 18:37:37 +0200 Subject: [PATCH] Check if the file exits when checking for attributes. --- .../Base/Project/Src/Services/File/FileChangeWatcher.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs b/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs index b73a8a7c9f..7dd94fe26f 100644 --- a/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs +++ b/src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs @@ -6,8 +6,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; + using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Gui; namespace ICSharpCode.SharpDevelop { @@ -89,7 +90,9 @@ namespace ICSharpCode.SharpDevelop activeWatchers.Add(this); SetWatcher(); - isFileReadOnly = (System.IO.File.GetAttributes(this.file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; + if (System.IO.File.Exists(this.file.FileName)) { + isFileReadOnly = (System.IO.File.GetAttributes(this.file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly; + } } void file_FileNameChanged(object sender, EventArgs e)