mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-26 03:22:40 +02:00
Opkman: Create destination directory if does not exists. Issue #32857.
git-svn-id: trunk@56808 -
This commit is contained in:
parent
48af81ac3b
commit
7258640282
@ -207,6 +207,7 @@ resourcestring
|
||||
'Please note: in order for the changes to take effect you must rebuid the IDE.';
|
||||
rsMainFrm_rsUninstall_Nothing = 'None of the checked packages are installed. Nothing to uninstall.';
|
||||
rsMainFrm_rsUninstall_Error = 'Cannot uninstall package "%s"!';
|
||||
rsMainFrm_rsDestDirError = 'Cannot create directory "%s". Operation aborted.';
|
||||
|
||||
//progress form
|
||||
rsProgressFrm_Caption0 = 'Downloading packages';
|
||||
|
@ -162,6 +162,7 @@ type
|
||||
procedure StartUpdates;
|
||||
procedure StopUpdates;
|
||||
procedure Rebuild;
|
||||
function CheckDstDir(const ADstDir: String): Boolean;
|
||||
public
|
||||
procedure ShowOptions(const AActivePageIndex: Integer = 0);
|
||||
end;
|
||||
@ -269,8 +270,27 @@ begin
|
||||
MessageDlgEx(rsMainFrm_rsNoPackageToDownload, mtInformation, [mbOk], Self)
|
||||
end;
|
||||
|
||||
function TMainFrm.CheckDstDir(const ADstDir: String): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
if not DirectoryExists(ADstDir) then
|
||||
begin
|
||||
if not ForceDirectories(ADstDir) then
|
||||
begin
|
||||
MessageDlgEx(Format(rsMainFrm_rsDestDirError, [ADstDir]), mtError, [mbOk], Self);
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TMainFrm.Download(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||
begin
|
||||
if not CheckDstDir(ADstDir) then
|
||||
begin
|
||||
Result := mrCancel;
|
||||
Exit;
|
||||
end;
|
||||
ADoExtract := False;
|
||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||
try
|
||||
@ -290,6 +310,11 @@ end;
|
||||
function TMainFrm.Extract(const ASrcDir, ADstDir: String; var ADoOpen: Boolean;
|
||||
const AIsUpdate: Boolean = False): TModalResult;
|
||||
begin
|
||||
if not CheckDstDir(ADstDir) then
|
||||
begin
|
||||
Result := mrCancel;
|
||||
Exit;
|
||||
end;
|
||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||
try
|
||||
PackageUnzipper := TPackageUnzipper.Create;
|
||||
@ -330,6 +355,11 @@ end;
|
||||
|
||||
function TMainFrm.UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||
begin
|
||||
if not CheckDstDir(ADstDir) then
|
||||
begin
|
||||
Result := mrCancel;
|
||||
Exit;
|
||||
end;
|
||||
ADoExtract := False;
|
||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||
try
|
||||
|
@ -199,6 +199,12 @@ begin
|
||||
Options.LocalRepositoryPackages := AppendPathDelim(edLocalRepositoryPackages.Text);
|
||||
Options.LocalRepositoryArchive := AppendPathDelim(edLocalRepositoryArchive.Text);
|
||||
Options.LocalRepositoryUpdate := AppendPathDelim(edLocalRepositoryUpdate.Text);
|
||||
if not DirectoryExists(Options.LocalRepositoryPackages) then
|
||||
ForceDirectories(Options.LocalRepositoryPackages);
|
||||
if not DirectoryExists(Options.LocalRepositoryArchive) then
|
||||
ForceDirectories(Options.LocalRepositoryArchive);
|
||||
if not DirectoryExists(Options.LocalRepositoryUpdate) then
|
||||
ForceDirectories(Options.LocalRepositoryUpdate);
|
||||
|
||||
Options.UserProfile := cbSelectProfile.ItemIndex;
|
||||
for I := 0 to lbExcludeFiles.Items.Count - 1 do
|
||||
|
Loading…
Reference in New Issue
Block a user