Esempio n. 1
0
 /// <summary>
 /// Open a file and ensure common exception types are wrapped to <see cref="IOException"/>.
 /// </summary>
 internal static Stream OpenFileWithNormalizedException(
     this ICommonCompilerFileSystem fileSystem,
     string filePath,
     FileMode fileMode,
     FileAccess fileAccess,
     FileShare fileShare
     )
 {
     try
     {
         return(fileSystem.OpenFile(filePath, fileMode, fileAccess, fileShare));
     }
     catch (ArgumentException)
     {
         throw;
     }
     catch (DirectoryNotFoundException e)
     {
         throw new FileNotFoundException(e.Message, filePath, e);
     }
     catch (IOException)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new IOException(e.Message, e);
     }
 }
 internal CompilerRelativePathResolver(
     ICommonCompilerFileSystem fileSystem,
     ImmutableArray <string> searchPaths,
     string?baseDirectory
     ) : base(searchPaths, baseDirectory)
 {
     FileSystem = fileSystem;
 }