如何使用Haskell创建符号链接? [英] How to create symlink with Haskell?

查看:127
本文介绍了如何使用Haskell创建符号链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用Haskell创建符号链接?

How to create a symlink with Haskell? The directory package to my knowledge does not provide a way to do it.

推荐答案

目录在我的知识中没有提供这种方法。

创建符号链接是不可移植的。例如,Windows上的创建符号链接很害羞;严格而害羞;编辑 1 。因此它不适合目录提供一个基本的ma­操作集; nip­ u­ lat­以便携的方式 (重点介绍)的文件和目录。这会影响所有与平台无关的软件包。

Creating a symbolic link is non-portable. For example, the creation symbolic links on Windows is re­strict­ed1. Therefore it does not fit into directory providing "a basic set of operations for ma­nip­u­lat­ing files and directories in a portable way" (emphasis mine). This affects all platform independent packages.

特定于平台的软件包 unix System.Posix.Files with createSymbolicLink 虽然:

The platform specific package unix provides that functionality in System.Posix.Files with createSymbolicLink though:

import System.Posix.Files (createSymbolicLink)

main :: IO ()
main = createSymbolicLink "/opt/ghc/7.10.3" "/opt/ghc/active"

1 :这也是为什么 unix-compat 没有实现 createSymbolicLink

1: That's also a reason why unix-compat does not implement createSymbolicLink

这篇关于如何使用Haskell创建符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆