安装到USB驱动器根目录时出现Inno Setup错误:“您必须输入带驱动器号的完整路径" [英] Inno Setup error when installing to USB drive root: "You must enter a full path with drive letter"

查看:116
本文介绍了安装到USB驱动器根目录时出现Inno Setup错误:“您必须输入带驱动器号的完整路径"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何解决这种错误:

I would like to know how to fix this kind of Error:

您必须输入包含驱动器号的完整路径;例如:C:\ APP或UNC路径,格式为:\ server \ share

You must enter a full path with drive letter; for example: C:\APP or a UNC path in the form: \server\share

每当我尝试强制Inno Setup Compiler(5.5.5 u)将我的东西放进去时,就会出现这种情况,比如说 H:\ 而不是 H:\ New Folder .

This appears whenever I try to force the Inno Setup Compiler (5.5.5 u) to put my stuff into, let say H:\ instead of H:\New Folder.

我需要编译器将目标位置自定义为 H:\ .

I need the compiler to customize my destination location to H:\.

这是我的示例程序;

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={drive:F:}
AppendDefaultDirName=no

[Files]
Source: "File1.txt"; DestDir: "{code:GetExeLocation|{app}\My_Portable_App}"; \
  Flags: ignoreversion 

[Code]
var
  UsagePage: TInputOptionWizardPage;

procedure InitializeWizard;
begin
  { Create the pages }
  UsagePage := CreateInputOptionPage(wpWelcome,
    'Installation Type', 'Select Installation Option',
    'Where would you like to install this program',
    True, False);
  UsagePage.Add('Normal – PC Hard Disk Installation ');
  UsagePage.Add('Portable – USB Drive Installation');

  {Set Default – Normal Install}
  UsagePage.SelectedValueIndex := 0;
end;

var
  bIsPortable : Boolean;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  // If we have clicked the next button on our custom page.
  if (CurPageID = UsagePage.ID) then
  begin
    bIsPortable := not (UsagePage.SelectedValueIndex = 0);
  end;
  result := true; // need to return a value so next key has an impact
end;

function GetExeLocation (Param: String) : String;
begin
  if bIsPortable then
    result := Param
  else
    result := Param;
end;

function InstallType(sRequiredType:String):Boolean;
begin
  if sRequiredType = 'Portable' then
    result := bIsPortable
  else
    result := not bIsPortable;
end;

说明:

当我选择"Normal – PC Hard Disk Installation"作为我的选择"时,我所有的安装文件或文件夹都应转到" C:\ My Program "的正常路径,但是当我选择便携式-USB驱动器安装";作为输入,我想将所有安装文件或文件夹直接放入USB随身碟根目录,即此处的 H:\ 中,其中的"H"代表是我选择放入我的USB Pen Drive盘符.但是我的程序不允许我这样做,而是默认添加一个新文件夹以将安装文件或文件夹放在那儿,即 H:\ New Folder ,我根本不需要它!当我强迫做我想做的事时,它结束了给我一个错误!

When I select "Normal – PC Hard Disk Installation", as my choice, all my installation files or folders should go to normal Path that is to C:\My Program, but when I select "Portable – USB Drive Installation" as my Entry, I would like to put all my installation files or folders directly into the USB Pen drive Root, that is in here H:\, where "H" is my USB Pen Drive letter which I have selected to put my stuff in. But my Program does not allow me to do so, instead it adds a New Folder by default to put my installation files or folders over there, that is to H:\New Folder which I do not need that at all!. And when I force to do what I want, it ends giving me an Error!

请我需要您的帮助来解决此问题,如果此inno-setup无法完成我想要的操作,请再给我指一个,对此我将非常感激!

Please I need Your Help to fix this, and if this inno-setup can not do what I want, please point me another one, and I will be Thankful for that!

让我们专注于第二个选择,即('便携式-USB驱动器安装')".因为那是我真正的目标.

Let focus on the second choice that is "('portable – usb drive installation')" because that is my real target.

从源头上:我进行了一些更改,以使其更加清晰.

From the Source: I made some changes so that to make it more clear.

我添加了我的目标目录,即 {code:GetExeLocation | {app} \ My_Portable_App} .因此,我想在这里将所有安装文件或文件夹安装在此目录中,我的意思是 My_Portable_App .我的USB笔式驱动器的路径应为 H:\ My_Portable_App .因此,当一切正常时,我只想在USB笔式驱动器中仅看到此文件夹 My_Portable_App ,其中将包含我的所有东西!

I added my destination Directory, that is {code:GetExeLocation|{app}\My_Portable_App}. So what I want here is that, all my installation files or folders to be installed inside this directory, I mean My_Portable_App. And the path to my USB pen drive should be H:\My_Portable_App. So when this goes fine, I want to see only This Folder My_Portable_App in my USB pen drive that will contain all my stuffs in there!!!

提前谢谢!

推荐答案

如果要直接安装到 h:\ 中,则应在位置框中明确输入该内容.如果您还想在使用浏览对话框后停止添加我的程序,那么您需要确保将 AppendDefaultDirName 设置为no.

If you want to install directly into h:\ then you should explicitly enter that into the location box. If you also want to stop the My Program being appended after using the browse dialog then you need to ensure that AppendDefaultDirName is set to no.

还请注意,对于文件2,如果 bIsPortable 为true,则 DestDir 最终将被设置为 {app}/{app} 很有可能会扩展到无效路径.

Also note that for file2, the DestDir will end up being set to {app}/{app} if bIsPortable is true which will most likely expand to an invalid path.

您最好的选择是使用 {code:...} 函数基于 bIsPortable 创建单个默认"路径,然后一切都可以安装到从此处 {app} .

Your best option is to use a {code:...} function to create a single "default" path based on bIsPortable and then everything can just install into {app} from there.

这篇关于安装到USB驱动器根目录时出现Inno Setup错误:“您必须输入带驱动器号的完整路径"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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