mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 03:15:33 +00:00
Merge pull request #2085 from keymanapp/developer-package-compiler-spurious-error-model-and-keyboard-fixes-2081
[Developer] Prevent package metadata preprocessor from treating .model.js files as keyboard files when they don't exist.
This commit is contained in:
commit
d2de4f46ce
1 changed files with 12 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ type
|
|||
function IsKeyboardFileByContent(f: TPackageContentFile): Boolean;
|
||||
function CheckKeyboardLanguages: Boolean;
|
||||
function CheckKeyboardTargetVersions: Boolean;
|
||||
function IsModelFileByName(f: TPackageContentFile): Boolean;
|
||||
public
|
||||
type TPackageKeyboardInfo = record
|
||||
Name, ID, Version: string;
|
||||
|
|
@ -222,6 +223,11 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TPackageInfoRefreshKeyboards.IsModelFileByName(f: TPackageContentFile): Boolean;
|
||||
begin
|
||||
Result := TRegEx.IsMatch(f.FileName, '\.model\.js$', [roIgnoreCase]);
|
||||
end;
|
||||
|
||||
function TPackageInfoRefreshKeyboards.IsKeyboardFileByName(f: TPackageContentFile): TKMFileType;
|
||||
begin
|
||||
if f.FileType = ftKeymanFile then
|
||||
|
|
@ -232,6 +238,12 @@ begin
|
|||
if f.FileType <> ftJavascript then
|
||||
Exit(ftOther);
|
||||
|
||||
// A lexical model file will typicaly have the extension .model.js. This prevents the
|
||||
// package editor from treating a lexical model as a keyboard when refreshing the list
|
||||
// of included keyboards
|
||||
if IsModelFileByName(f) then
|
||||
Exit(ftOther);
|
||||
|
||||
// Need to test if the JS is a valid keyboard file.
|
||||
// This is a bit of a pain... but we have to stick with .js for compat
|
||||
if not FileExists(f.FileName) or IsKeyboardFileByContent(f) then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue