pas2js: download: use directory on second try, added darwin aarch64 url

This commit is contained in:
mattias 2024-10-14 16:42:27 +02:00
parent 1ebfb0903e
commit 8bba8cfb58
10 changed files with 74 additions and 12 deletions

View File

@ -120,6 +120,7 @@ type
procedure Apply;
procedure CheckSimpleWebserver(SetServerIfEmpty: boolean);
function ShowProgressDialog(aCaption, ANote: string; const OnExecute: TNotifyEvent): boolean;
function DirectoryIsEmpty(aDir: string): boolean;
protected
public
procedure Init;
@ -349,18 +350,28 @@ begin
try
//InputHistories.ApplyFileDialogSettings(aDialog);
//aDialog.Options:=aDialog.Options+[ofPathMustExist];
aDialog.Title:='Select directory where to extract Pas2js';
if not aDialog.Execute then exit;
aDir:=CleanAndExpandDirectory(aDialog.Filename);
if not DirectoryExists(aDir) then
aDir:=CleanAndExpandDirectory(Pas2jsSrcDirComboBox.Text);
if (not DirectoryExists(aDir)) or (not DirectoryIsEmpty(aDir)) then
begin
if not ForceDirectoriesUTF8(aDir) then
// ask for a directory
aDialog.Title:=pjsdSelectDirectoryWhereToExtractPas2js;
if aDir<>'' then
aDialog.InitialDir:=aDir;
if not aDialog.Execute then exit;
aDir:=CleanAndExpandDirectory(aDialog.Filename);
if not DirectoryExists(aDir) then
begin
s:=Format(pjsdUnableToCreateDirectory, [aDir]);
DetailsMemo.Lines.Add(Format(pjsdError2, [s]));
IDEMessageDialog(pjsdError, s, mtError, [mbOk]);
exit;
if not ForceDirectoriesUTF8(aDir) then
begin
s:=Format(pjsdUnableToCreateDirectory, [aDir]);
DetailsMemo.Lines.Add(Format(pjsdError2, [s]));
IDEMessageDialog(pjsdError, s, mtError, [mbOk]);
exit;
end;
end;
// set Pas2jsSrcDir
SetComboBoxText(Pas2jsSrcDirComboBox,aDir,cstFilename,30);
end;
// download
@ -379,9 +390,6 @@ begin
// unzip
UnzipRelease(aDir);
// set Pas2jsSrcDir
SetComboBoxText(Pas2jsSrcDirComboBox,aDir,cstFilename,30);
// set Pas2js compile exe
if FFoundPas2jsExe='' then
begin
@ -732,6 +740,25 @@ begin
end;
end;
function TPas2jsInstallerDialog.DirectoryIsEmpty(aDir: string): boolean;
var
Info: TRawByteSearchRec;
begin
aDir:=AppendPathDelim(aDir);
if FindFirst(aDir+GetAllFilesMask,faAnyFile,Info)=0 then
begin
repeat
case Info.Name of
'','.','..': ;
else
Result:=false;
break;
end;
until FindNext(Info)<>0;
end;
FindCloseUTF8(Info);
end;
procedure TPas2jsInstallerDialog.Init;
begin
FOldPas2jsExe:=PJSOptions.CompilerFilename;
@ -749,6 +776,8 @@ begin
FReleaseURL+='windows/pas2js-win64-x86_64-current.zip';
{$ELSEIF defined(Darwin) and defined(CPU64)}
FReleaseURL+='darwin/pas2js-darwin-x86_64-current.zip';
{$ELSEIF defined(Darwin) and defined(CPUAarch64)}
FReleaseURL+='darwin/pas2js-darwin-aarch64-current.zip';
{$ELSEIF defined(Linux) and defined(CPU64)}
FReleaseURL+='linux/pas2js-linux-x86_64-current.zip';
{$ELSE}

View File

@ -345,6 +345,10 @@ msgstr "Sélectionner le répertoire du modèle de paquet Atom"
msgid "Select browser executable"
msgstr "Sélectionner l'exécutable du navigateur"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -347,6 +347,10 @@ msgstr ""
msgid "Select browser executable"
msgstr "A böngésző alkalmazás kiválasztása"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -335,6 +335,10 @@ msgstr ""
msgid "Select browser executable"
msgstr ""
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -350,6 +350,10 @@ msgstr "Selecionar diretório de modelos de pacote do Atom"
msgid "Select browser executable"
msgstr "Selecionar executável do navegador"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -348,6 +348,10 @@ msgstr "Выберите каталог шаблона пакета Atom"
msgid "Select browser executable"
msgstr "Выберите исполнимый файл браузера"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr "Выберите исполнимый файл Electron"

View File

@ -347,6 +347,10 @@ msgstr ""
msgid "Select browser executable"
msgstr ""
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -350,6 +350,10 @@ msgstr "Виберіть теку шаблонів пакунка Atom"
msgid "Select browser executable"
msgstr "Вибрати виконуваний файл оглядача"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -349,6 +349,10 @@ msgstr "选择 Atom 软件包模板目录"
msgid "Select browser executable"
msgstr "选择浏览器可执行文件"
#: strpas2jsdesign.pjsdselectdirectorywheretoextractpas2js
msgid "Select directory where to extract Pas2js"
msgstr ""
#: strpas2jsdesign.pjsdselectelectronexecutable
msgid "Select Electron executable"
msgstr ""

View File

@ -27,6 +27,7 @@ Resourcestring
pjsdDownloadedBytes = 'Downloaded %s bytes';
pjsdDownloadPas2jsRelease = 'Download Pas2JS Release?';
pjsdUnableToCreateDirectory = 'Unable to create directory "%s".';
pjsdSelectDirectoryWhereToExtractPas2js = 'Select directory where to extract Pas2js';
pjsdConfirmation = 'Confirmation';
pjsdChangeSimpleWebServerFromTo = 'Change Simple Web Server from%s"%s"%sto%s'
+'"%s"%s?';