作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在我的数据库文件设置结束时浏览或创建一个新目录。
我创建了一个 TInputDirWizardPage
来选择目录,然后我使用一个按钮来启动数据库安装。
我的问题是没有创建新目录并且数据库安装失败。
这是我的代码:
[Code]
var
Page0: TInputQueryWizardPage;
Page1: TInputDirWizardPage;
{ Launch DB CLIP installation }
procedure ButtonOnClick(Sender: TObject);
var
Params: string;
ScriptPath: string;
ResultCode: Integer;
DBPath: string;
Server: String;
Instance: String;
SQL_User: String;
SQL_Password: String;
begin
DBPath := Page1.Values[0];
Server:= Page0.Values[0];
Instance:= Page0.Values[1];
SQL_User:= Page0.Values[2];
SQL_Password:= Page0.Values[3];
ScriptPath := ExpandConstant('"{app}\DB\Create Database 2.12.3.sql"');
Params := '-v CLIPDATA="'+DBPath+'" CLIPINDEX="'+DBPath+'" CLIPLOG="'+DBPath+'" -S '+Server+'\'+Instance+' -U '+SQL_User+' -P '+SQL_Password+' -i '+ScriptPath ;
if MsgBox('' + Params + '', mbInformation, mb_YesNo) = idYes then
Exec ('sqlcmd',Params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
Exit;
end;
procedure InitializeWizard();
var
DBButton: TNewButton;
begin
Page0 := CreateInputQueryPage(wpInfoAfter,
'SQL Informations', '',
'Please specify Server and Instance name , then click Next.');
Page0.Add('Server:', False);
Page0.Add('Instance:', False);
Page0.Add('SQL User:', False);
Page0.Add('SQL Password:', True);
Page0.Values[0] := ('localhost');
Page0.Values[1] := ('CLIP');
Page0.Values[2] := ('sa');
Page0.Values[3] := ('clip');
Page1 := CreateInputDirPage(Page0.ID,
'Select CLIP Database files Location', '',
'CLIP DB data files will be stored in the following folder.'#13#10#13#10 +
'To continue, click Next. ' +
'If you would like to select a different folder, click Browse.',
False, 'New Folder');
Page1.Add('Database Folder');
Page1.Values[0] := ExpandConstant('{pf}\CLIP\CLIP_DATA\DB\');
DBButton := TNewButton.Create(Page1);
DBButton.Left := ScaleX(16);
DBButton.Top := ScaleY(205);
DBButton.Width := ScaleX(100);
DBButton.Height := ScaleY(25);
DBButton.Caption := 'Install DB CLIP';
DBButton.OnClick := @ButtonOnClick;
DBButton.Parent := Page1.Surface;
end;
最佳答案
CreateInputDirPage
不会自行创建所选目录。
创建新文件夹 按钮不会创建物理文件夹。它只在树中创建一个虚拟节点。
我知道这与 documentation 有点矛盾,它说:
Make New Folder button will be shown that creates a new folder with the specified default name.
如果要真正为所选路径创建物理文件夹,请使用CreateDir
function在您的 ButtonOnClick
处理程序中。
if not DirExists(DBPath) then
begin
CreateDir(DBPath);
end;
关于inno-setup - CreateInputDirPage/TInputDirWizardPage 不创建所选目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49651675/
我正在尝试用 Swift 编写这段 JavaScript 代码:k_combinations 到目前为止,我在 Swift 中有这个: import Foundation import Cocoa e
我是一名优秀的程序员,十分优秀!