<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-04-25 3:23 GMT-03:00 zeljko <span dir="ltr"><<a href="mailto:zeljko@holobit.net" target="_blank">zeljko@holobit.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="">On 04/25/2014 07:21 AM, silvioprog wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
2014-04-17 14:50 GMT-03:00 Mattias Gaertner <<a href="mailto:nc-gaertnma@netcologne.de" target="_blank">nc-gaertnma@netcologne.de</a><br></div>
<mailto:<a href="mailto:nc-gaertnma@netcologne.de" target="_blank">nc-gaertnma@<u></u>netcologne.de</a>>>:<div class=""><br>
<br>
On Thu, 17 Apr 2014 14:35:07 -0300<br></div><div class="">
silvioprog <<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a> <mailto:<a href="mailto:silvioprog@gmail.com" target="_blank">silvioprog@gmail.com</a>>> wrote:<br>
<br>
> 2014-04-16 22:07 GMT-03:00 waldo kitty <<a href="mailto:wkitty42@windstream.net" target="_blank">wkitty42@windstream.net</a><br></div>
<mailto:<a href="mailto:wkitty42@windstream.net" target="_blank">wkitty42@windstream.<u></u>net</a>>>:<div><div class="h5"><br>
> [...]<br>
><br>
> > and you don't get any kind of exception or other error results??<br>
> ><br>
><br>
> No error occurs, and it doesn't opens file. :/<br>
><br>
> I'm trying to debug LCL in trying to figure out the problem ...<br>
<br>
The OpenDocument function does not raise exceptions under Linux. It<br>
returns false if no application was found.<br>
<br>
It should be improved to raise an exception for the errors it can spot.<br>
Like not finding the application or if the program returns bytes on<br>
Stderr or if the ExitCode<>0.<br>
<br>
<br>
I found the error. In a terminal, when I call:<br>
<br>
$ xdg-open test.txt<br>
<br>
The "test.txt" file is opened into terminal. But when I call:<br>
<br>
$ gnome-open test.txt<br>
<br>
The "test.txt" file is opened into Pluma Editor (native text editor on<br>
Linux Mint, like GEdit in Ubuntu).<br>
<br>
Then seems a problem in Linux Mint (Mate).<br>
<br>
To solve my problem, I changed the function from:<br>
<br>
[code]<br>
function OpenDocument(APath: String): Boolean;<br>
var<br>
lApp: string;<br>
begin<br>
// Android uses this<br>
if Assigned(<u></u>OpenDocumentWidgetsetImplement<u></u>ation) then<br>
begin<br>
Result := OpenDocumentWidgetsetImplement<u></u>ation(APath);<br>
Exit;<br>
end;<br>
<br>
Result := True;<br>
if not FileExistsUTF8(APath) then exit(false);<br>
<br>
lApp:=FindFilenameOfCmd('xdg-<u></u>open'); // Portland OSDL/FreeDesktop<br>
standard on Linux<br>
if lApp='' then<br>
lApp:=FindFilenameOfCmd('<u></u>kfmclient'); // KDE command<br>
if lApp='' then<br>
lApp:=FindFilenameOfCmd('<u></u>gnome-open'); // GNOME command<br>
if lApp='' then<br>
Exit(False);<br>
<br>
if (APath<>'') and (APath[1]<>'"') then<br>
APath:=QuotedStr(APath);<br>
RunCmdFromPath(lApp,APath);<br>
end;<br>
[/code]<br>
<br>
To:<br>
<br>
[code]<br>
function OpenDocument(const APath: String): Boolean;<br>
var<br>
lApp: string;<br>
begin<br>
// Android uses this<br>
if Assigned(<u></u>OpenDocumentWidgetsetImplement<u></u>ation) then<br>
begin<br>
Result := OpenDocumentWidgetsetImplement<u></u>ation(APath);<br>
Exit;<br>
end;<br>
<br>
Result := True;<br>
if not FileExistsUTF8(APath) then exit(false);<br>
<br>
lApp:=FindFilenameOfCmd('<u></u>gnome-open'); // GNOME command<br>
if lApp='' then<br>
lApp:=FindFilenameOfCmd('<u></u>kfmclient') // KDE command<br>
else<br>
if lApp='' then<br>
lApp:=FindFilenameOfCmd('xdg-<u></u>open') // Portland OSDL/FreeDesktop<br>
standard on Linux<br>
else<br>
if lApp='' then<br>
Exit(False);<br>
<br>
if (APath<>'') and (APath[1]<>'"') then<br>
APath:=QuotedStr(APath);<br>
RunCmdFromPath(lApp,APath);<br>
end;<br>
[/code]<br>
<br>
Quick fix! :p<br>
</div></div></blockquote>
<br>
But not so good. Maybe you have kde and gnome and you are currently using gnome desktop. Calling kfclient can be pita in this case since kde isn't loaded so kfmclient will load bulk of libs and it can be slow.<br>
My proposal for fallback will be check for current desktop env and then call appropriate application (only if xdg-open fails).</blockquote></div><div><br></div><div>Yes, and I implemented a 'quick fix' local in my program, to call the "gnome-open" directly, solving my problem, until a better solution comes along.</div>
<div><br></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>