Hi all, I’m stumped! I’ve used this several times in my app and it it’s always works fine but now it doesn’t in Linux. Works fine in Windows. I have a menu option to open the application documentation which is a .pdf file. When I select it from the menu, nothing happens. I can open the file with the file manager by double clicking on it. I have triple checked the path. It doesn’t make sense. The file should open. I’ve already tried changing the file name to something with no spaces. No change.
Var f As FolderItem
Select Case Platform //what os
Case "Win" //windows
f = SpecialFolder.ApplicationData.Child("My_Software").Child("Talents").Child("Talents Documentation.pdf")
Case "Lin" //linux
f = SpecialFolder.Documents.Child("Talents Documentation.pdf")
End Select
If f.Exists Then
f.open
Else
MessageBox "File not found!"
End
Return True
Offhand, it sounds like Xojo can’t find the default pdf app in your Linux environment, while it can for rtf. f.open would depend on that. It’s odd, of course, that the file manager CAN find this, which implies that it is set somewhere.
Well, I happened to have a Gentoo VM running while I’ve been reading this. I whipped together a quick test with code like yours and the pdf opened successfully (in Firefox.)
To go off on a tangent, I would suggest that instead of doing the Select Case, instead do
Ok, issue solved. I compared the properties of the documents that would open with those that would not open and found the property “Allow executing file as program” was check on those files that would not open and visa versa. I unchecked the box and the files open correctly from within my app. I don’t know why that setting is on when the pdf is created by either Word or Libre but now I know what to look for.
Guess I should have looked at this first instead of wasting your time. My apologies. You all are always so helpful.