Inno Setup Compiler会显示“找不到指定的路径".长路径错误 [英] Inno Setup Compiler "Cannot find the path specified" error with long paths

查看:646
本文介绍了Inno Setup Compiler会显示“找不到指定的路径".长路径错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.iss脚本在 Inno中构建 exe 文件设置编译器.我需要将一些 node_modules 打包到此应用程序中,因此在[Files]下有一行,如下所示:

I am using a .iss script to build an exe file inside Inno Setup Compiler. I need to package some node_modules into this application so I have a line under [Files] which looks like this:

Source: "{#SourcePath}Encore.Warehouse.UI\bin\Warehouse_Release\warehouse\*"; \
    DestDir: "{app}\warehouse"; Flags: ignoreversion recursesubdirs createallsubdirs

我编译时收到此错误:

这是编译器的输出:

因此,似乎可以正常运行,直到中止为止.我最初的想法是browser.js不存在,但经过仔细检查后,情况并非如此.另外,我在源路径中使用通配符,因此编译器知道文件存在,但是似乎在压缩文件时遇到了麻烦.

So, it appears to be running fine up until it aborted. My initial thought was that the browser.js doesn't exist but after double checking, this is not the case. Also, I'm using a wildcard in the source path so the compiler knows the file exists, but it seems to be having trouble compressing it.

可能引起问题的另一件事是文件路径长度.由于嵌套依赖性,节点模块通常最终具有荒谬的文件路径长度.在这种情况下,路径长度为 260 .假设这是导致问题的原因,有什么办法可以解决它?

One other thing that could be causing the issue is the file path length. Node modules usually end up having ridiculous file path lengths due to nested dependencies. In this case, the path length is 260. Assuming this is what's causing the problem, is there any way to get around it?

推荐答案

这肯定是由于路径很长.通常,Windows应用程序不能处理长度超过MAX_PATH(260个字符)的路径.
请参见命名文件, MSDN上的路径和命名空间.

It's definitely due to a long path. Normally Windows applications cannot process paths longer than MAX_PATH (260 characters).
See Naming Files, Paths, and Namespaces on the MSDN.

一个常见的解决方法是在路径前面加上\\?\(再次参见上面的MSDN文章).该前缀只能用于绝对路径.但是Inno Setup编译器使用Source属性对此感到窒息.它会查找:,并且仅接受仅在:之前具有驱动器号或使用compiler:userdocs:前缀的路径.

A common workaround is prefixing the path with \\?\ (again see the MSDN article above). The prefix can be used for absolute paths only. But Inno Setup compiler chokes on that with the Source attribute. It looks for : and it accepts only path that either have a drive letter only before the : or that use compiler: or userdocs: prefixes.

您可以使用带有卷ID(因此没有冒号)的UNC路径来破解它.

You can hack that by using an UNC path with a volume ID (hence no colon).

使用mountvol命令查找源驱动器的UNC路径.

Use the mountvol command to find the UNC path for your source drive.

然后,在安装时(而不是在编译时)具有DestDir属性的长路径会遇到相同的问题.在那里,冒号没有问题,因此您只需使用\\?\前缀即可.

And then you will have the same problem with a long path with the DestDir attribute, while installing (not when compiling). There, there's no problem with the colon, so you can simply use the \\?\ prefix.

Source: "\\?\Volume{bb919c3e-bdb1-42b8-9601-6715becd8683}\{#SourcePath}Encore.Warehouse.UI\bin\Warehouse_Release\warehouse\*"; \
    DestDir: "\\?\{app}\warehouse"; Flags: ignoreversion recursesubdirs createallsubdirs


当然,如果问题是由于根路径已经太长而引起的,则只需将源文件移动到路径较短的文件夹即可解决此问题.或者,您可以使用subst创建虚拟驱动器,也可以创建符号链接/目录连接.


Of course, if the problem is caused by a root path being too long already, you can fix the problem simply be moving the source files to a folder with a shorter path. Or you can use subst to create a virtual drive or you can create a symlink/directory junction.

这篇关于Inno Setup Compiler会显示“找不到指定的路径".长路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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