Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions vsintegration/tests/UnitTests/ProjectOptionsBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ open System.IO
open System.Xml.Linq
open FSharp.Compiler.SourceCodeServices

module FileSystemHelpers =
let safeDeleteFile (path: string) =
try
File.Delete(path)
with
| _ -> ()

let safeDeleteDirectory (path: string) =
try
Directory.Delete(path)
with
| _ -> ()

type FSharpProject =
{
Directory: string
Expand All @@ -29,9 +42,10 @@ type FSharpProject =
member this.Dispose() =
// delete each source file
this.Files
|> List.iter (fun (path, _contents) -> File.Delete(path))
|> List.map fst
|> List.iter FileSystemHelpers.safeDeleteFile
// delete the directory
Directory.Delete(this.Directory)
FileSystemHelpers.safeDeleteDirectory (this.Directory)
// project file doesn't really exist, nothing to delete
()

Expand Down