@@ -508,9 +508,9 @@ type SourceTree (files:SourceFile list) =
508508
509509 /// Check if the target exists in the project file tree
510510 let hasTarget ( target : string ) =
511- let target = normalizeFileName target
512- if isDirectory target then tree.ContainsKey target
513- elif data.ContainsKey target then true else
511+ let temp = normalizeFileName target
512+ if isDirectory temp then tree.ContainsKey temp
513+ elif data.ContainsKey temp then true else
514514 false
515515
516516 let moveFile shift target =
@@ -617,24 +617,25 @@ type SourceTree (files:SourceFile list) =
617617 // TODO - check path & name for validity
618618 // TODO - if there's a .fs & .fsi pair rename both files
619619 if not ^ hasTarget path then ()
620- elif not ^ checkFile newName " is not a valid file name" then () else
621- let path = normalizeFileName path
622- let dir = getDirectory path
623- let file = Path.GetFileName path
624- // update the SourceFile record
625- if data.ContainsKey path then
626- let srcfile = { data.[ path] with Include = dir+ newName}
627- data.Remove path |> ignore
628- data.[ dir+ newName] <- srcfile
629- // update the file position listing
630- if tree.ContainsKey dir then
631- let arr = tree.[ dir]
632- printfn " %A " arr
633- let idx = ResizeArray.findIndex ((=) file) arr
634- arr.[ idx] <- newName
635- tree.[ dir] <- arr
636-
637- // TODO add railway result/errors
620+ elif not ^ checkFile newName " is not a valid file name" then ()
621+ else
622+ let path = normalizeFileName path
623+ let dir = getDirectory path
624+ let file = Path.GetFileName path
625+ // update the SourceFile record
626+ if data.ContainsKey path then
627+ let srcfile = { data.[ path] with Include = newName}
628+ data.Remove path |> ignore
629+ data.[ newName] <- srcfile
630+ // update the file position listing
631+ if tree.ContainsKey dir then
632+ let arr = tree.[ dir]
633+ printfn " %A " arr
634+ let idx = ResizeArray.findIndex ((=) file) arr
635+ arr.[ idx] <- newName
636+ tree.[ dir] <- arr
637+
638+ // TODO add railway result/errors
638639
639640
640641 member __.RenameDir ( dir : string ) ( newName : string ) =
0 commit comments