anchor.diff:  ﻿[<AutoOpen>]
  +/// Contains helpers which allow to interact with the file system.
   module Fake.FileSystemHelper
   
   open System
   open System.IO
   
  -/// Creates a DirectoryInfo for the given path
  +/// Creates a DirectoryInfo for the given path.
   let inline directoryInfo path = new DirectoryInfo(path)
   
  -/// Creates a FileInfo for the given path
  +/// Creates a FileInfo for the given path.
   let inline fileInfo path = new FileInfo(path)
   
   /// Creates a FileInfo or a DirectoryInfo for the given path
  
positive.code:         new FileNotFoundException(sprintf "Could not find file matching %s in %s" pattern dir)
            |> raise
  
  /// Gets the current directory
  let currentDirectory = Path.GetFullPath "."
  
  /// Get the full location of the current assembly
  let fullAssemblyPath = System.Reflection.Assembly.GetAssembly(typeof<RegistryBaseKey>).Location
  
  /// Checks if the file exists on disk.
  let fileExists = File.Exists
  
  /// Raises an exception if the file doesn't exist on disk.
  let checkFileExists fileName =
      if not <| fileExists fileName then 
          failwithf "File %s does not exist." fileName
  
  /// Checks if all given files exist
  let allFilesExist files = Seq.forall fileExists files
  
  /// Normalizes a filename.
  
negative.code:         then upcast directoryInfo path
          else upcast fileInfo path
  
  /// Converts a filename to it's full file system name.
  let inline FullName fileName = Path.GetFullPath fileName
  
  /// Gets the directory part of a filename.
  let inline DirectoryName fileName = Path.GetDirectoryName fileName
  
  /// Gets all subdirectories of a given directory.
  let inline subDirectories (dir:DirectoryInfo) = dir.GetDirectories()
  
  /// Gets all files in the directory.
  let inline filesInDir (dir:DirectoryInfo) = dir.GetFiles()
  
  /// Finds all the files in the directory matching the search pattern.
  let filesInDirMatching pattern (dir:DirectoryInfo) =
      if dir.Exists then dir.GetFiles pattern else [||]
  
  /// Gets the first file in the directory matching the search pattern as an option value.
  let TryFindFirstMatchingFile pattern dir =
      dir 
      |> directoryInfo
      |> filesInDirMatching pattern
      |> fun files -> if Seq.isEmpty files then None else (Seq.head files).FullName |> Some
  
  /// Gets the first file in the directory matching the search pattern or throws an error if nothing was found.
  let FindFirstMatchingFile pattern dir =
      match TryFindFirstMatchingFile pattern dir with
      | Some x -> x
  