mirror of https://gitlab.com/basile.b/dexed.git
added function to test if a file is a native project
This commit is contained in:
parent
f9d8bd95b2
commit
104d6bc3b6
|
@ -91,6 +91,9 @@ type
|
|||
property outputFilename: string read fOutputFilename;
|
||||
end;
|
||||
|
||||
// native project have no ext constraint, this function tells if filename is project
|
||||
function isValidNativeProject(const filename: string): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
|
@ -771,6 +774,24 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function isValidNativeProject(const filename: string): boolean;
|
||||
var
|
||||
maybe: TCENativeProject;
|
||||
begin
|
||||
result := false;
|
||||
// avoid the project to notify the observers, current project is not replaced
|
||||
EntitiesConnector.beginUpdate;
|
||||
maybe := TCENativeProject.create(nil);
|
||||
EntitiesConnector.removeSubject(maybe);
|
||||
try
|
||||
maybe.loadFromFile(filename);
|
||||
result := maybe.hasLoaded;
|
||||
finally
|
||||
maybe.Free;
|
||||
EntitiesConnector.endUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterClasses([TCENativeProject]);
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue