@@ -17,9 +17,17 @@ module Environment =
1717 if isWin then a + @" \" + b
1818 else a + " /" + b
1919
20- let private dirExists dir = fs.statSync( dir) .isDirectory()
20+ let private dirExists dir =
21+ try
22+ fs.statSync( dir) .isDirectory()
23+ with
24+ | _ -> false
2125
22- let private fileExists file = fs.statSync( file) .isFile()
26+ let private fileExists file =
27+ try
28+ fs.statSync( file) .isFile()
29+ with
30+ | _ -> false
2331
2432 let private getOrElse defaultValue option =
2533 match option with
@@ -49,25 +57,25 @@ module Environment =
4957
5058 let private getListDirectoriesToSearchForTools () =
5159 if isWin then
52- [ getToolsPathFromConfiguration (); getToolsPathWindows () ]
60+ [ getToolsPathFromConfiguration (); getToolsPathWindows () ]
5361 else
5462 [ getToolsPathFromConfiguration () ]
5563 |> List.choose id
56-
64+
5765 let private findFirstValidFilePath exeName directoryList =
5866 directoryList
5967 |> List.map ( fun v -> v </> exeName)
60- |> List.tryFind fileExists
68+ |> List.tryFind fileExists
6169
6270 let private getFsiFilePath () =
6371 if isWin then
6472 let cfg = workspace.getConfiguration ()
6573 let fsiPath = cfg.get( " FSharp.fsiFilePath" , " " )
66- if fsiPath = " " then " FsiAnyCpu.exe" else fsiPath
74+ if fsiPath = " " then " FsiAnyCpu.exe" else fsiPath
6775 else " fsharpi"
6876
6977 let fsi =
70- let fileName = getFsiFilePath ()
78+ let fileName = getFsiFilePath ()
7179 let dirs = getListDirectoriesToSearchForTools ()
7280 match findFirstValidFilePath fileName dirs with
7381 | None -> fileName
0 commit comments