mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Write error message to console when can not open .desktop file
This commit is contained in:
parent
d7da2d115b
commit
0f2b310bcc
2 changed files with 17 additions and 3 deletions
|
|
@ -91,10 +91,20 @@ function g_key_file_get_boolean(key_file: PGKeyFile; const group_name: Pgchar;
|
|||
{ TKeyFile }
|
||||
|
||||
constructor TKeyFile.Create(const AFileName: String; AEscapeLineFeeds: Boolean);
|
||||
var
|
||||
AMessage: UTF8String;
|
||||
AError: PGError = nil;
|
||||
begin
|
||||
FGKeyFile:= g_key_file_new();
|
||||
if not g_key_file_load_from_file(FGKeyFile, Pgchar(AFileName), G_KEY_FILE_NONE, nil) then
|
||||
raise EFOpenError.CreateFmt(SFOpenError, [AFileName]);
|
||||
if not g_key_file_load_from_file(FGKeyFile, Pgchar(AFileName), G_KEY_FILE_NONE, @AError) then
|
||||
begin
|
||||
if Assigned(AError) then
|
||||
begin
|
||||
AMessage:= StrPas(AError^.message);
|
||||
g_error_free(AError);
|
||||
end;
|
||||
raise EFOpenError.CreateFmt(SFOpenErrorEx, [AFileName, AMessage]);
|
||||
end;
|
||||
inherited Create(AFileName, AEscapeLineFeeds);
|
||||
CaseSensitive:= True;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,11 @@ begin
|
|||
DesktopEntryFile.Free;
|
||||
end;
|
||||
except
|
||||
Result:= nil;
|
||||
on E: Exception do
|
||||
begin
|
||||
Result:= nil;
|
||||
WriteLn('GetDesktopEntry: ', E.Message);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue