Merge pull request #14650 from keymanapp/fix/developer/14348-handle-failure-to-create-dest-path-in-new-keyboard-project

fix(developer): handle failure to create destination path when generating new project
This commit is contained in:
Marc Durdin 2025-08-31 06:37:03 +02:00 committed by GitHub
commit 2ec7ad4dd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 45 additions and 9 deletions

View file

@ -251,6 +251,8 @@ begin
except
on E:EKeyboardProjectTemplate do
Exit(Fail('Unable to generate template: '+E.Message));
on E:EFOpenError do
Exit(Fail('Unable to create project; template files may be missing: '+E.Message));
end;
FProjectFilename := FTemplate.ProjectFilename;

View file

@ -86,7 +86,8 @@ end;
procedure TKeyboardProjectTemplate.Generate;
begin
if not ForceDirectories(BasePath + ID + '\' + SFolder_Source) then
raise EKeyboardProjectTemplate.Create('Could not create destination path '+BasePath+ID);
raise EKeyboardProjectTemplate.Create('Could not create destination path '''+BasePath+ID+'''. '+
'Please check the path and try again. The error was: '+SysErrorMessage(GetLastError));
WriteDocumentation;

View file

@ -7,6 +7,7 @@ procedure Run;
implementation
uses
System.Classes,
System.SysUtils,
Winapi.ActiveX,
@ -100,7 +101,12 @@ begin
except
on E:EKeyboardProjectTemplate do
begin
writeln(E.Message);
writeln('ERROR: Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
writeln('ERROR: Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;
@ -138,7 +144,12 @@ begin
except
on E:ELDMLKeyboardProjectTemplate do
begin
writeln(E.Message);
writeln('ERROR: Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
writeln('ERROR: Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;
@ -176,7 +187,12 @@ begin
except
on E:EModelProjectTemplate do
begin
writeln(E.Message);
writeln('ERROR: Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
writeln('ERROR: Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;

View file

@ -56,7 +56,8 @@ end;
procedure TLDMLKeyboardProjectTemplate.Generate;
begin
if not ForceDirectories(BasePath + ID + '\' + SFolder_Source) then
raise ELDMLKeyboardProjectTemplate.Create('Could not create destination path '+BasePath+ID);
raise ELDMLKeyboardProjectTemplate.Create('Could not create destination path '''+BasePath+ID+'''. '+
'Please check the path and try again. The error was: '+SysErrorMessage(GetLastError));
WriteDocumentation;

View file

@ -70,7 +70,8 @@ end;
procedure TModelProjectTemplate.Generate;
begin
if not ForceDirectories(BasePath + ID + '\' + SFolder_Source) then
raise EModelProjectTemplate.Create('Could not create destination path '+BasePath+ID);
raise EModelProjectTemplate.Create('Could not create destination path '''+BasePath+ID+'''. '+
'Please check the path and try again. The error was: '+SysErrorMessage(GetLastError));
WriteDocumentation;

View file

@ -154,11 +154,16 @@ begin
try
pt.Generate;
except
on E:EFOpenError do
on E:ELDMLKeyboardProjectTemplate do
begin
ShowMessage('Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
ShowMessage('Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;
frmKeymanDeveloper.OpenProject(pt.ProjectFilename);

View file

@ -166,11 +166,16 @@ begin
try
pt.Generate;
except
on E:EFOpenError do
on E:EModelProjectTemplate do
begin
ShowMessage('Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
ShowMessage('Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;
frmKeymanDeveloper.OpenProject(pt.ProjectFilename);

View file

@ -167,11 +167,16 @@ begin
try
pt.Generate;
except
on E:EFOpenError do
on E:EKeyboardProjectTemplate do
begin
ShowMessage('Unable to create project: '+E.Message);
Exit(False);
end;
on E:EFOpenError do
begin
ShowMessage('Unable to create project; template files may be missing: '+E.Message);
Exit(False);
end;
end;
frmKeymanDeveloper.OpenProject(pt.ProjectFilename);