从 Windows 访问 cygwin 符号链接 [英] Accessing a cygwin symlink from windows

查看:21
本文介绍了从 Windows 访问 cygwin 符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 cygwin 很陌生.我创建了一个符号链接如下

I am quite new to cygwin. I created a symlink as follows

$ ln -s /var/www /cygdrive/d/foo

当我通过 Windows 检查 D 驱动器时,我看到一个名为 foo 的系统文件.有没有办法让 foo 充当 Windows 的文件夹而不是系统文件?

and when I check the D drive via windows, I see a system file called foo. Is there a way to make foo act as a folder for Windows instead of a system file?

推荐答案

我不知道.Cygwin 不会将操作系统更新为具有符号链接,而是允许您从 Cygwin shell 中伪造"符号链接.您可以将 shell 设置为使用 Windows LNK 文件,这可能会执行您想要的操作,但是...

Not that I know of. Cygwin doesn't update the OS to have symlinks, rather, it allows you to 'fake' symlinks from within the Cygwin shell. You can set up the shell to use Windows LNK files, which may do what you want, but ...

来自 Cygwin 文档:

使用 cygutils 创建快捷方式

Creating shortcuts with cygutils

另一个问题区域是Unix 风格的链接,链接一个文件到另一个和 Microsoft .lnk 文件,它提供了文件的快捷方式.乍一看,它们看起来很相似,但是,在现实中,是相当不同的.经过默认情况下,Cygwin 不创建符号链接为 .lnk 文件,但有一个执行此操作的选项,请参阅该部分称为CYGWIN 环境多变的".这些符号链接 .lnk 文件与 Windows 创建的兼容.lnk 文件,但它们仍然是不同的.它们不包括很多可用的信息标准 Microsoft 快捷方式,例如工作目录、图标等cygutils 软件包包括一个用于创建的 mkshortcut 实用程序标准原生 Microsoft .lnk 文件.

Another problem area is between Unix-style links, which link one file to another, and Microsoft .lnk files, which provide a shortcut to a file. They seem similar at first glance but, in reality, are fairly different. By default, Cygwin does not create symlinks as .lnk files, but there's an option to do that, see the section called "The CYGWIN environment variable". These symlink .lnk files are compatible with Windows-created .lnk files, but they are still different. They do not include much of the information that is available in a standard Microsoft shortcut, such as the working directory, an icon, etc. The cygutils package includes a mkshortcut utility for creating standard native Microsoft .lnk files.

但这就是问题所在.如果赛格温处理了这些本机快捷方式,例如任何其他符号链接,你不能将 Microsoft .lnk 文件归档到 tar存档并保留所有信息在他们之中.打开包装后,这些捷径会失去所有额外的信息,不会不同于标准 Cygwin符号链接.因此这两类链接被区别对待.不幸的是,这意味着通常的 Unix 创建和使用方式符号链接不适用于本机Windows 快捷方式.

But here's the problem. If Cygwin handled these native shortcuts like any other symlink, you could not archive Microsoft .lnk files into tar archives and keep all the information in them. After unpacking, these shortcuts would have lost all the extra information and would be no different than standard Cygwin symlinks. Therefore these two types of links are treated differently. Unfortunately, this means that the usual Unix way of creating and using symlinks does not work with native Windows shortcuts.

这篇关于从 Windows 访问 cygwin 符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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