mirror of https://gitlab.com/basile.b/dexed.git
test more robustly if file is a project
- on open with (cmd line arg) - on drag file to editor
This commit is contained in:
parent
9cca5e1b12
commit
55671cf9e6
|
@ -435,31 +435,25 @@ procedure TCEMainForm.getCMdParams;
|
||||||
var
|
var
|
||||||
value: string;
|
value: string;
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
hdl: THandle;
|
|
||||||
str: string;
|
|
||||||
begin
|
begin
|
||||||
if application.ParamCount > 0 then
|
if application.ParamCount > 0 then
|
||||||
begin
|
begin
|
||||||
value := application.Params[1];
|
value := application.Params[1];
|
||||||
if value <> '' then
|
if value <> '' then
|
||||||
begin
|
begin
|
||||||
setLength(str, 6);
|
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
lst.DelimitedText := value;
|
lst.DelimitedText := value;
|
||||||
for value in lst do
|
for value in lst do
|
||||||
begin
|
begin
|
||||||
if not fileExists(value) then
|
if isEditable(ExtractFileExt(value)) then
|
||||||
continue;
|
openFile(value)
|
||||||
hdl := FileOpen(value, fmOpenRead);
|
else if isValidNativeProject(value) then
|
||||||
if hdl = 0 then
|
begin
|
||||||
continue;
|
// so far CE can only open 1 project at a time
|
||||||
FileRead(hdl, str[1], length(str));
|
openProj(value);
|
||||||
FileClose(hdl);
|
break;
|
||||||
if str = 'object' then
|
end;
|
||||||
openProj(value)
|
|
||||||
else
|
|
||||||
openFile(value);
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
|
@ -1202,10 +1196,17 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.FormDropFiles(Sender: TObject;const FileNames: array of String);
|
procedure TCEMainForm.FormDropFiles(Sender: TObject;const FileNames: array of String);
|
||||||
var
|
var
|
||||||
i: NativeInt;
|
fname: string;
|
||||||
begin
|
begin
|
||||||
for i:= low(FileNames) to high(FileNames) do
|
for fname in FileNames do
|
||||||
openFile(FileNames[i]);
|
begin
|
||||||
|
if isValidNativeProject(fname) then
|
||||||
|
begin
|
||||||
|
openProj(fname);
|
||||||
|
break;
|
||||||
|
end
|
||||||
|
else openFile(fname);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue