FilePather 0.0.1 → 0.0.2
raw patch · 3 files changed
+42/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ System.FilePath.FilePather: indir :: FilePath -> (FilePath -> IO a) -> IO a
+ System.FilePath.FilePather: indir' :: FilePath -> IO a -> IO a
Files
- FilePather.cabal +11/−7
- LICENSE +5/−1
- System/FilePath/FilePather.hs +26/−1
FilePather.cabal view
@@ -1,5 +1,5 @@ Name: FilePather-Version: 0.0.1+Version: 0.0.2 Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> Maintainer: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> Copyright: Tony Morris@@ -10,18 +10,18 @@ Description: Functions over @System.FilePath@ including a find function for recursing down directories. .- /This package is similar to the filemanip package but without the unix and mtl dependencies./+ /This package is similar to the filemanip package but without the mtl dependency./ . Usage example: . @ -- find all haskell source files in the current directory, recursing all the way down- findHere always (extensionEq "hs") >>= mapM_ putStrLn- ./Setup.hs- ./System/FilePath/FilePather.hs+ findHere always (extensionEq \"hs\") >>= mapM_ putStrLn+ .\/Setup.hs+ .\/System\/FilePath\/FilePather.hs @-Homepage: https://bitbucket.org/dibblego/filepather/-Cabal-version: >= 1.2+Homepage: https://github.com/tonymorris/filepather+Cabal-version: >= 1.6 Build-Type: Simple Flag small_base@@ -43,3 +43,7 @@ Exposed-Modules: System.FilePath.FilePather++source-repository head+ type: git+ location: git@github.com:tonymorris/filepather.git
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2009 Tony Morris+Copyright 2011 Tony Morris All rights reserved. @@ -24,4 +24,8 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+<<<<<<< HEAD SUCH DAMAGE.+=======+SUCH DAMAGE.+>>>>>>> upstream/master
System/FilePath/FilePather.hs view
@@ -50,9 +50,12 @@ extensionSatisfies, extensionOneOf, extensionEq,- findHere+ findHere,+ indir,+ indir' ) where +import Control.Exception import Control.Applicative import Control.Monad import Data.Monoid@@ -368,6 +371,28 @@ -> IO [FilePath] -- ^ All files found. findHere r x = find r x =<< getCurrentDirectory++-- | Switches to the given directory, runs the given action by passing the current directory and running in the switched directory, then returns to the current directory. The directory is switched back, even if an exception occurs during execution of the action.+--+-- | This is useful to run a script in a different directory without switching to it and back again.+indir ::+ FilePath -- ^ The directory to switch to.+ -> (FilePath -> IO a) -- ^ The action to run after being given the current directory.+ -> IO a -- ^ The result of running the action in the switched directory.+indir d k =+ do c <- getCurrentDirectory+ setCurrentDirectory d+ k c `finally` setCurrentDirectory c++-- | Switches to the given directory, runs the given action and running in the switched directory, then returns to the current directory. The directory is switched back, even if an exception occurs during execution of the action.+--+-- | This is useful to run a script in a different directory without switching to it and back again.+indir' ::+ FilePath -- ^ The directory to switch to.+ -> IO a -- ^ The action to run.+ -> IO a -- ^ The result of running the action in the switched directory.+indir' d =+ indir d . const -- not exported constant ::