73://Pluginディレクトリィへのファイルコピーの準備
74: Auto := False;
75: Base := ExtractFilePath(Params.Items[0]);
76: Prefix := 'stpl';
77:
78://ADSによるセットアップかどうかの判別
79: InstallDir := PluginDir + '\' + Prefix;
80: if (Params.Count > 1) then DebugText(Params.Items[1]);
81: if (Params.Count > 1) and (LowerCase(Params.Items[1]) = '-auto') then begin
82: Auto := True;
83: end;
84: Failed := False;
85: Log := TStringList.Create;
86:
87://ベースディレクトリィが相対ディレクトリィじゃない時 かつ
88://ベースディレクトリィとインストール先ディレクトリィが違うとき、ファイルのコピーを実行
89: if (Base <> 'stpl\') and (Base <> InstallDir +'\') then begin
90: if not DirectoryExists(InstallDir) then begin
91: if not CreateDir(InstallDir) then begin
92: Log.Add('NG: フォルダ(' + InstallDir + ') が作成できませんでした');
93: Failed := True;
94: end;
95: end;
96:
97: if not Failed then begin
98: CopyFileEx(Base + 'setup.pas' , InstallDir + '\setup.pas' , False);
99: CopyFileEx(Base + 'setup.dfm' , InstallDir + '\setup.dfm' , False);
100: CopyFileEx(Base + 'stplBrowser.dfm', InstallDir + '\stplBrowser.dfm', False);
101: CopyFileEx(Base + 'autostpl.r' , InstallDir + '\autostpl.r' , False);
102: CopyFileEx(Base + 'stplBrowser.pas', InstallDir + '\stplBrowser.pas', False);
103: CopyFileEx(Base + 'download.h' , InstallDir + '\download.h' , False);
104: CopyFileEx(Base + 'stpl.htm' , InstallDir + '\stpl.htm' , False);
105: CopyFileEx(Base + 'autostpl.rx' , InstallDir + '\autostpl.rx' , False);
106: CopyFileEx(Base + 'stpl.ico' , InstallDir + '\stpl.ico' , False);
107: CopyFileEx(Base + 'stplBrowser.ico', InstallDir + '\stplBrowser.ico', False);
108: CopyFileEx(Base + 'stpl.txt' , InstallDir + '\stpl.txt' , False);
109: CopyFileEx(Base + 'stplBrowser.txt', InstallDir + '\stplBrowser.txt', False);
110: end;
111:
112://ファイルコピー失敗時、インストール不成功のログを保存し、設定保存ボタンを無効に
113: if Failed then begin
114: Log.Add('RESULT: FAILED');
115: Log.SaveToFile(Base + 'setup.log');
116: cmdOK.Enabled:=False;
117: ShowMessage('- 『スタパライフ』セットアップ -'#13#10'インストールに失敗しました.');
118: end else begin
119://インストール成功のログを保存
120: Log.Add('NAME: 『スタパライフ』Agent for airWeb');
121: Log.Add('VERSION: 1.20');
122: Log.Add('DIRECTORY: ' + InstallDir);
123: Log.Add('RESULT: SUCCESS');
124: Log.SaveToFile(Base + 'setup.log');
125: Log.Free;
126: end;
127: end;
|