如何使用 Haskell 创建符号链接?这directory
据我所知,包没有提供一种方法来做到这一点。
Creating a symbolic link is non-portable. For example, the creation symbolic links on Windows is restricted https://en.wikipedia.org/wiki/NTFS_symbolic_link#Restrictions1. Therefore it does not fit into directory
providing "a basic set of operations for manipulating files and directories in a portable way" https://hackage.haskell.org/package/directory (emphasis mine). This affects all platform independent packages.
平台特定包unix https://hackage.haskell.org/package/unix提供该功能System.Posix.Files with createSymbolicLink https://hackage.haskell.org/package/unix-2.7.1.0/docs/System-Posix-Files.html#g:9 though:
import System.Posix.Files (createSymbolicLink)
main :: IO ()
main = createSymbolicLink "/opt/ghc/7.10.3" "/opt/ghc/active"
1: That's also a reason why unix-compat
does not implement createSymbolicLink https://github.com/jystic/unix-compat/blob/master/src/System/PosixCompat/Files.hsc#L371-L378
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)