El_Trueno 发表于 2023-5-30 11:33:29

[1.20 - pre7 相关信息] 什么是符号链接?


https://attachment.mcbbs.net/data/myattachment/common/3c/common_499_icon.png 转载须知

[*]本篇为https://klpbbs.com/thread-102413-1-1.html的补充说明。
[*]转载本帖时须要注明原作者以及本帖地址。




What Are Symbolic Links?什么是符号链接?

A symbolic link (sometimes called a “symlink”) is a way to make a file name in one place on a file system refer to a different file, elsewhere. Symbolic links are supported by all operating systems Minecraft runs on.
符号链接(symbolic link,有时也被称为 symlink)可以使文件系统某一位置的文件名引用其它地方的另一文件。Minecraft 可运行的各个操作系统目前都支持使用符号链接。

Symbolic links can sometimes be useful when you want to place content in different locations but some application (in this case, Minecraft) expects those files to exist in a certain location, like for example wanting some Minecraft worlds to be placed on a separate storage device.
符号链接在这样的场景中往往能发挥作用:当某些应用程序(在这里指 Minecraft)希望一些文件存储于特定位置,而你出于某种原因,例如想要将一些 Minecraft 世界存储在另外的存储设备上,而想要将部分文件存储在另外的位置时,你就可以使用符号链接。

HOW CAN SYMBOLIC LINKS BE DANGEROUS?
为什么说符号链接存在风险?

Because a symbolic link could lead anywhere on your drive, having a symbolic link show up unexpectedly could mean Minecraft could read or write files it is not supposed to. This applies especially in cases where the symbolic link came from unpacking an archive (e.g., a Zip file) from an outside source, like a Minecraft world downloaded from the internet.
这是因为符号链接可以指向驱动器上的任何地方,所以意外的符号链接可能导致 Minecraft 读取或写入本不应该读取的文件。该问题往往出现在读取了来自外部源的压缩文件形式存档(例如,Zip 格式文件)例如从互联网下载的 Minecraft 世界时。

If Minecraft was to attempt to write a file that is a symbolic link to another important file on your drive, that file might get overwritten with the Minecraft world contents, potentially causing loss of data.
如果 Minecraft 试图写入一个文件,而该文件是指向驱动器上另一个重要文件的符号链接,则该文件可能会被 Minecraft 世界内容覆盖,进而导致数据丢失。

Minecraft versions starting with 1.20 show an error when trying to open worlds that contain symbolic links.
从 1.20 版本开始,Minecraft 在尝试打开包含符号链接的世界时报错。

If you see an error message about symbolic links when opening a world you downloaded from the internet or in any other situation where you haven’t knowingly created the symbolic links yourself this might be an indication that the content you downloaded is malicious.
如果你发现有关符号链接的报错,而此世界是从互联网上下载,或者此符号链接是在其它任何你不知情的情况下被创建的,则表明你可能下载了一个恶意文件。

Do not attempt to open such downloaded worlds.
请勿尝试打开这样的世界。

HOW CAN I ENABLE SYMBOLIC LINKS IN MINECRAFT JAVA EDITION?
在 Java 版中如何启用符号链接?

There are cases where symbolic links are useful. If you have such a use case and have created the symbolic links yourself, you can allow Minecraft to access the target of those links. To do this, you will need to create or edit a file called “allowed_symlinks.txt” in your Minecraft folder.
符号链接在一些情况下还是有用的。如果你有这样的需求,并且确认符号链接是由自己创建的,那么你可以为 Minecraft 添加这些链接目标的访问权限。为此,你需要在你的 Minecraft 文件夹中创建或编辑一个名为 “allowed_symlinks.txt” 的文件。

Each line in this file contains one allowed path. Symbolic links are followed only if the target of the link has a path starting with one of paths specified in this file.
该文件中,每一行都包含一个允许的路径。只有当符号链接的目标路径以此文件中指定的路径之一开头时,才能被允许访问。

For instance, let’s say you want to store some of your worlds on D:\MinecraftSaves to save space on your C: drive (on Windows). You’d add this line to “allowed_symlinks.txt”:
举例,假设你(在 Windows 系统中)想要将一些世界存储在 D:\ minecraftsaved 中,以节省 C: 驱动器的空间。那么你可以将这一行添加到 “allowed_symlinks.txt” 中:

D:\MinecraftSaves

If you are still getting an error, you can find out exactly which targets are being rejected by looking at the errors in your “latest.log” file under the “logs” folder.
如果依然报错,那么你可以通过查看 “logs” 文件夹下的 “latest.log” 文件来准确找出哪些目标被拒绝了。


【氘氚人 译自 https://help.minecraft.net/hc/en-us/articles/16165590199181】


玄猫 发表于 2023-6-18 22:20:59

……11111
页: [1]
查看完整版本: [1.20 - pre7 相关信息] 什么是符号链接?