mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-29 20:43:06 +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.';
|
'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_Nothing = 'None of the checked packages are installed. Nothing to uninstall.';
|
||||||
rsMainFrm_rsUninstall_Error = 'Cannot uninstall package "%s"!';
|
rsMainFrm_rsUninstall_Error = 'Cannot uninstall package "%s"!';
|
||||||
|
rsMainFrm_rsDestDirError = 'Cannot create directory "%s". Operation aborted.';
|
||||||
|
|
||||||
//progress form
|
//progress form
|
||||||
rsProgressFrm_Caption0 = 'Downloading packages';
|
rsProgressFrm_Caption0 = 'Downloading packages';
|
||||||
|
@ -162,6 +162,7 @@ type
|
|||||||
procedure StartUpdates;
|
procedure StartUpdates;
|
||||||
procedure StopUpdates;
|
procedure StopUpdates;
|
||||||
procedure Rebuild;
|
procedure Rebuild;
|
||||||
|
function CheckDstDir(const ADstDir: String): Boolean;
|
||||||
public
|
public
|
||||||
procedure ShowOptions(const AActivePageIndex: Integer = 0);
|
procedure ShowOptions(const AActivePageIndex: Integer = 0);
|
||||||
end;
|
end;
|
||||||
@ -269,8 +270,27 @@ begin
|
|||||||
MessageDlgEx(rsMainFrm_rsNoPackageToDownload, mtInformation, [mbOk], Self)
|
MessageDlgEx(rsMainFrm_rsNoPackageToDownload, mtInformation, [mbOk], Self)
|
||||||
end;
|
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;
|
function TMainFrm.Download(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||||
begin
|
begin
|
||||||
|
if not CheckDstDir(ADstDir) then
|
||||||
|
begin
|
||||||
|
Result := mrCancel;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
ADoExtract := False;
|
ADoExtract := False;
|
||||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||||
try
|
try
|
||||||
@ -290,6 +310,11 @@ end;
|
|||||||
function TMainFrm.Extract(const ASrcDir, ADstDir: String; var ADoOpen: Boolean;
|
function TMainFrm.Extract(const ASrcDir, ADstDir: String; var ADoOpen: Boolean;
|
||||||
const AIsUpdate: Boolean = False): TModalResult;
|
const AIsUpdate: Boolean = False): TModalResult;
|
||||||
begin
|
begin
|
||||||
|
if not CheckDstDir(ADstDir) then
|
||||||
|
begin
|
||||||
|
Result := mrCancel;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||||
try
|
try
|
||||||
PackageUnzipper := TPackageUnzipper.Create;
|
PackageUnzipper := TPackageUnzipper.Create;
|
||||||
@ -330,6 +355,11 @@ end;
|
|||||||
|
|
||||||
function TMainFrm.UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
function TMainFrm.UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
|
||||||
begin
|
begin
|
||||||
|
if not CheckDstDir(ADstDir) then
|
||||||
|
begin
|
||||||
|
Result := mrCancel;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
ADoExtract := False;
|
ADoExtract := False;
|
||||||
ProgressFrm := TProgressFrm.Create(MainFrm);
|
ProgressFrm := TProgressFrm.Create(MainFrm);
|
||||||
try
|
try
|
||||||
|
@ -199,6 +199,12 @@ begin
|
|||||||
Options.LocalRepositoryPackages := AppendPathDelim(edLocalRepositoryPackages.Text);
|
Options.LocalRepositoryPackages := AppendPathDelim(edLocalRepositoryPackages.Text);
|
||||||
Options.LocalRepositoryArchive := AppendPathDelim(edLocalRepositoryArchive.Text);
|
Options.LocalRepositoryArchive := AppendPathDelim(edLocalRepositoryArchive.Text);
|
||||||
Options.LocalRepositoryUpdate := AppendPathDelim(edLocalRepositoryUpdate.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;
|
Options.UserProfile := cbSelectProfile.ItemIndex;
|
||||||
for I := 0 to lbExcludeFiles.Items.Count - 1 do
|
for I := 0 to lbExcludeFiles.Items.Count - 1 do
|
||||||
|
Loading…
Reference in New Issue
Block a user