Browse Source

Fixed exception when an open solution file is deleted.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3827 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
3093c60ae9
  1. 7
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  2. 12
      src/Main/Base/Project/Src/Project/Solution/Solution.cs

7
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -129,11 +129,14 @@ namespace ICSharpCode.SharpDevelop.Project
[ReadOnly(true)] [ReadOnly(true)]
public virtual bool ReadOnly { public virtual bool ReadOnly {
get { get {
if (File.Exists(FileName)) { try {
FileAttributes attributes = File.GetAttributes(FileName); FileAttributes attributes = File.GetAttributes(FileName);
return ((FileAttributes.ReadOnly & attributes) == FileAttributes.ReadOnly); return ((FileAttributes.ReadOnly & attributes) == FileAttributes.ReadOnly);
} catch (FileNotFoundException) {
return false;
} catch (DirectoryNotFoundException) {
return true;
} }
return false;
} }
} }

12
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -219,8 +219,14 @@ namespace ICSharpCode.SharpDevelop.Project
public bool ReadOnly { public bool ReadOnly {
get get
{ {
FileAttributes attributes = File.GetAttributes(fileName); try {
return ((FileAttributes.ReadOnly & attributes) == FileAttributes.ReadOnly); FileAttributes attributes = File.GetAttributes(fileName);
return ((FileAttributes.ReadOnly & attributes) == FileAttributes.ReadOnly);
} catch (FileNotFoundException) {
return false;
} catch (DirectoryNotFoundException) {
return true;
}
} }
} }
#endregion #endregion
@ -502,7 +508,7 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
} }
if (!newSolution.ReadOnly && (newSolution.FixSolutionConfiguration(newSolution.Projects) || needsConversion)) { if (!newSolution.ReadOnly && (newSolution.FixSolutionConfiguration(newSolution.Projects) || needsConversion)) {
// save in new format // save in new format
newSolution.Save(); newSolution.Save();

Loading…
Cancel
Save