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 Apply;
procedure CheckSimpleWebserver(SetServerIfEmpty: boolean); procedure CheckSimpleWebserver(SetServerIfEmpty: boolean);
function ShowProgressDialog(aCaption, ANote: string; const OnExecute: TNotifyEvent): boolean; function ShowProgressDialog(aCaption, ANote: string; const OnExecute: TNotifyEvent): boolean;
function DirectoryIsEmpty(aDir: string): boolean;
protected protected
public public
procedure Init; procedure Init;
@ -349,18 +350,28 @@ begin
try try
//InputHistories.ApplyFileDialogSettings(aDialog); //InputHistories.ApplyFileDialogSettings(aDialog);
//aDialog.Options:=aDialog.Options+[ofPathMustExist]; //aDialog.Options:=aDialog.Options+[ofPathMustExist];
aDialog.Title:='Select directory where to extract Pas2js'; aDir:=CleanAndExpandDirectory(Pas2jsSrcDirComboBox.Text);
if not aDialog.Execute then exit; if (not DirectoryExists(aDir)) or (not DirectoryIsEmpty(aDir)) then
aDir:=CleanAndExpandDirectory(aDialog.Filename);
if not DirectoryExists(aDir) then
begin 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 begin
s:=Format(pjsdUnableToCreateDirectory, [aDir]); if not ForceDirectoriesUTF8(aDir) then
DetailsMemo.Lines.Add(Format(pjsdError2, [s])); begin
IDEMessageDialog(pjsdError, s, mtError, [mbOk]); s:=Format(pjsdUnableToCreateDirectory, [aDir]);
exit; DetailsMemo.Lines.Add(Format(pjsdError2, [s]));
IDEMessageDialog(pjsdError, s, mtError, [mbOk]);
exit;
end;
end; end;
// set Pas2jsSrcDir
SetComboBoxText(Pas2jsSrcDirComboBox,aDir,cstFilename,30);
end; end;
// download // download
@ -379,9 +390,6 @@ begin
// unzip // unzip
UnzipRelease(aDir); UnzipRelease(aDir);
// set Pas2jsSrcDir
SetComboBoxText(Pas2jsSrcDirComboBox,aDir,cstFilename,30);
// set Pas2js compile exe // set Pas2js compile exe
if FFoundPas2jsExe='' then if FFoundPas2jsExe='' then
begin begin
@ -732,6 +740,25 @@ begin
end; end;
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; procedure TPas2jsInstallerDialog.Init;
begin begin
FOldPas2jsExe:=PJSOptions.CompilerFilename; FOldPas2jsExe:=PJSOptions.CompilerFilename;
@ -749,6 +776,8 @@ begin
FReleaseURL+='windows/pas2js-win64-x86_64-current.zip'; FReleaseURL+='windows/pas2js-win64-x86_64-current.zip';
{$ELSEIF defined(Darwin) and defined(CPU64)} {$ELSEIF defined(Darwin) and defined(CPU64)}
FReleaseURL+='darwin/pas2js-darwin-x86_64-current.zip'; 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)} {$ELSEIF defined(Linux) and defined(CPU64)}
FReleaseURL+='linux/pas2js-linux-x86_64-current.zip'; FReleaseURL+='linux/pas2js-linux-x86_64-current.zip';
{$ELSE} {$ELSE}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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