Browse Source

Fixed forum-10179: move file up/down in F# binding crashes SharpDevelop

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5062 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
9914989d40
  1. 2
      src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/fsi.fs
  2. 13
      src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/project.fs

2
src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/fsi.fs

@ -53,7 +53,7 @@ module TheControl = @@ -53,7 +53,7 @@ module TheControl =
else
let path = Environment.GetEnvironmentVariable("PATH")
let paths = path.Split([|';'|])
let path = paths |> Array.tryfind (fun x -> try File.Exists(Path.Combine(x, "fsi.exe")) with _ -> false)
let path = paths |> Array.tryFind (fun x -> try File.Exists(Path.Combine(x, "fsi.exe")) with _ -> false)
match path with
| Some x ->
fsiProcess.StartInfo.FileName <- Path.Combine(x, "fsi.exe")

13
src/AddIns/BackendBindings/FSharp/FSharpBinding/Project/Src/project.fs

@ -174,18 +174,19 @@ module ProjectHelpers = @@ -174,18 +174,19 @@ module ProjectHelpers =
doc.Load(project.FileName)
let nsmgr = new XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("proj", "http://schemas.microsoft.com/developer/msbuild/2003")
let d = new Dictionary<FileNode,XmlNode>()
nodes |> forEachFileNode
(fun node ->
let docNode = doc.SelectSingleNode(Printf.sprintf @"//proj:Compile[@Include=""%s""]" (Path.GetFileName(node.FileName)), nsmgr)
docNode.ParentNode.RemoveChild(docNode) |> ignore)
if docNode <> null then
d.[node] <- docNode
docNode.ParentNode.RemoveChild(docNode) |> ignore)
let itemNode = doc.SelectSingleNode("//proj:ItemGroup", nsmgr)
nodes |> forEachFileNode
(fun node ->
let xmlElem = doc.CreateElement("", "Compile", "http://schemas.microsoft.com/developer/msbuild/2003")
let xmlAttr = doc.CreateAttribute("Include")
xmlAttr.InnerText <- Path.GetFileName(node.FileName)
xmlElem.Attributes.Append(xmlAttr) |> ignore
itemNode.AppendChild(xmlElem) |> ignore)
let found, xmlElem = d.TryGetValue(node)
if found then
itemNode.AppendChild(xmlElem) |> ignore)
doc.Save(project.FileName)

Loading…
Cancel
Save