FolderItem.Open doesn't open file in Linux Manjaro

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.

Seems similar to: FolderItem.Open problem (with pdf)

Here is the code for the menu handler:

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

In debug info:

Exist = True
NativePath=/home/james/Documents/Talents Documentation.pdf

Any ideas/thoughts as to why the file will not open and how to resolve this?

Now this is interesting. If I change the format of the document to a rtf, it opens fine but won’t open if it’s a pdf.

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.

What happens if you define a File Type Set for pdf?

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

#if TargetWindows
//f=Windows path
#elseif TargetLinux
//f=Linux path
#endif

Then there is no need to do the platform evaluation the way you are. Instead, the compiler just gives each what it needs.

Thanks Jerry

1 Like

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.