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 =
else else
let path = Environment.GetEnvironmentVariable("PATH") let path = Environment.GetEnvironmentVariable("PATH")
let paths = path.Split([|';'|]) 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 match path with
| Some x -> | Some x ->
fsiProcess.StartInfo.FileName <- Path.Combine(x, "fsi.exe") fsiProcess.StartInfo.FileName <- Path.Combine(x, "fsi.exe")

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

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

Loading…
Cancel
Save