-
Notifications
You must be signed in to change notification settings - Fork 701
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow specifying default behaviour as a install-method flag input, ad…
…d documentation
- Loading branch information
Showing
8 changed files
with
122 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,58 @@ | ||
{-# LANGUAGE CPP #-} | ||
module Distribution.Client.Compat.Directory (setModificationTime) where | ||
module Distribution.Client.Compat.Directory ( | ||
setModificationTime, | ||
createFileLink, | ||
pathIsSymbolicLink, | ||
getSymbolicLinkTarget, | ||
) where | ||
|
||
#if MIN_VERSION_directory(1,2,3) | ||
import System.Directory (setModificationTime) | ||
#else | ||
|
||
import Data.Time.Clock (UTCTime) | ||
#endif | ||
|
||
#if MIN_VERSION_directory(1,3,1) | ||
import System.Directory (createFileLink, getSymbolicLinkTarget, pathIsSymbolicLink) | ||
#elif defined(MIN_VERSION_unix) | ||
import System.Posix.Files (createSymbolicLink, getSymbolicLinkStatus, isSymbolicLink, readSymbolicLink) | ||
#endif | ||
|
||
------------------------------------------------------------------------------- | ||
-- setModificationTime | ||
------------------------------------------------------------------------------- | ||
|
||
#if !MIN_VERSION_directory(1,2,3) | ||
|
||
setModificationTime :: FilePath -> UTCTime -> IO () | ||
setModificationTime _fp _t = return () | ||
|
||
#endif | ||
|
||
------------------------------------------------------------------------------- | ||
-- Symlink | ||
------------------------------------------------------------------------------- | ||
|
||
#if MIN_VERSION_directory(1,3,1) | ||
#elif defined(MIN_VERSION_unix) | ||
createFileLink :: FilePath -> FilePath -> IO () | ||
createFileLink = createSymbolicLink | ||
|
||
pathIsSymbolicLink :: FilePath -> IO Bool | ||
pathIsSymbolicLink fp = do | ||
status <- getSymbolicLinkStatus fp | ||
return (isSymbolicLink status) | ||
|
||
getSymbolicLinkTarget :: FilePath -> IO FilePath | ||
getSymbolicLinkTarget = readSymbolicLink | ||
|
||
#else | ||
createFileLink :: FilePath -> FilePath -> IO () | ||
createFileLink _ _ = fail "Symlinking feature not available" | ||
|
||
pathIsSymbolicLink :: FilePath -> IO Bool | ||
pathIsSymbolicLink _ = fail "Symlinking feature not available" | ||
|
||
getSymbolicLinkTarget :: FilePath -> IO FilePath | ||
getSymbolicLinkTarget _ = fail "Symlinking feature not available" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters