<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-04-17 14:50 GMT-03:00 Mattias Gaertner <span dir="ltr"><<a href="mailto:nc-gaertnma@netcologne.de" target="_blank">nc-gaertnma@netcologne.de</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 Thu, 17 Apr 2014 14:35:07 -0300<br>
silvioprog <<a href="mailto:silvioprog@gmail.com">silvioprog@gmail.com</a>> wrote:<br>
<br>
> 2014-04-16 22:07 GMT-03:00 waldo kitty <<a href="mailto:wkitty42@windstream.net">wkitty42@windstream.net</a>>:<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>
</div>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.</blockquote><div><br></div><div>I found the error. In a terminal, when I call:</div><div><br></div><div>$ xdg-open test.txt</div><div><br></div><div>The "test.txt" file is opened into terminal. But when I call:</div>
<div><br></div><div>$ gnome-open test.txt</div><div><br></div><div>The "test.txt" file is opened into Pluma Editor (native text editor on Linux Mint, like GEdit in Ubuntu).</div><div><br></div><div>Then seems a problem in Linux Mint (Mate).</div>
<div><br></div><div>To solve my problem, I changed the function from:</div><div><br></div><div>[code]</div><div><div>function OpenDocument(APath: String): Boolean;</div><div>var</div><div> lApp: string;</div><div>begin</div>
<div> // Android uses this</div><div> if Assigned(OpenDocumentWidgetsetImplementation) then</div><div> begin</div><div> Result := OpenDocumentWidgetsetImplementation(APath);</div><div> Exit;</div><div> end;</div>
<div><br></div><div> Result := True;</div><div> if not FileExistsUTF8(APath) then exit(false);</div><div><br></div><div> lApp:=FindFilenameOfCmd('xdg-open'); // Portland OSDL/FreeDesktop standard on Linux</div>
<div> if lApp='' then</div><div> lApp:=FindFilenameOfCmd('kfmclient'); // KDE command</div><div> if lApp='' then</div><div> lApp:=FindFilenameOfCmd('gnome-open'); // GNOME command</div>
<div> if lApp='' then</div><div> Exit(False);</div><div><br></div><div> if (APath<>'') and (APath[1]<>'"') then</div><div> APath:=QuotedStr(APath);</div><div> RunCmdFromPath(lApp,APath);</div>
<div>end;</div></div><div>[/code]</div><div><br></div><div>To:</div><div><br></div><div>[code]</div><div><div>function OpenDocument(const APath: String): Boolean;</div><div>var</div><div> lApp: string;</div><div>begin</div>
<div> // Android uses this</div><div> if Assigned(OpenDocumentWidgetsetImplementation) then</div><div> begin</div><div> Result := OpenDocumentWidgetsetImplementation(APath);</div><div> Exit;</div><div> end;</div>
<div><br></div><div> Result := True;</div><div> if not FileExistsUTF8(APath) then exit(false);</div><div><br></div><div> lApp:=FindFilenameOfCmd('gnome-open'); // GNOME command</div><div> if lApp='' then</div>
<div> lApp:=FindFilenameOfCmd('kfmclient') // KDE command</div><div> else</div><div> if lApp='' then</div><div> lApp:=FindFilenameOfCmd('xdg-open') // Portland OSDL/FreeDesktop standard on Linux</div>
<div> else</div><div> if lApp='' then</div><div> Exit(False);</div><div><br></div><div> if (APath<>'') and (APath[1]<>'"') then</div><div> APath:=QuotedStr(APath);</div><div>
RunCmdFromPath(lApp,APath);</div><div>end;</div></div><div>[/code]<br></div><div><br></div><div>Quick fix! :p<br></div><div><br></div></div>-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>