Skip to content

Commit

Permalink
Merge pull request #513 from brianary/PushdPopd
Browse files Browse the repository at this point in the history
Add pushd/popd to FileUtils
  • Loading branch information
forki committed Aug 3, 2014
2 parents 5dd0dbc + 6d3168e commit bcb5603
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/FakeLib/FileUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ let cd path = chdir path
/// Gets working directory
let pwd = Directory.GetCurrentDirectory

/// The stack of directories operated on by pushd and popd
let dirStack = new System.Collections.Generic.Stack<string>()

/// Store the current directory in the directory stack before changing to a new one
let pushd path =
dirStack.Push(pwd())
cd path

/// Restore the previous directory stored in the stack
let popd () =
cd <| dirStack.Pop()

/// Like "mv" in a shell. Moves/renames a file
/// <param name="src">The source</param>
/// <param name="dest">The destination</param>
Expand Down

0 comments on commit bcb5603

Please sign in to comment.