Desktop File Types Query

  1. (Target macOS issue) Can anyone remind me how do I define file types to be recognized when dragging items over the App icon in the dock (macOS)?
    I’m almost certain there was a Listbox with checkboxes in the macOS build settings, but I just can’t find it.

  2. (All Targets) Is there a way to define that the app accepts ALL file types, not just specific predefined/known kinds? (my users have all kinds of crazy/unique file types they handle that I can’t predict all of them beforehand)

I wrote a new app that organizes files into subfolders by file types to explain just a bit.
The user enters the file types he wants to organize and name the destination subfolders to be created accordingly. There’s a lot more going on, but I won’t get into that because it’s irrelevant.

It works great, but those two missing things above limit the users, one, no drag & drop on the app icon (and no pushed arguments from Automator, etc.), and two, the user can’t add file types that I didn’t predefined, well he can because I’m dynamically adding FileType.Extensions according to the user input, but it only works after the user had open the app, so he can’t push those as an argument into the app.OpenDocument event.
The perfect thing for me would be that the app accepts all file types, and once it gets all the items, I can sort them properly according to the user’s wishes (which of course vary from user to user).

You have to add some File Types (Insert → FileTypeGroup).

There is a default entry for file types named any or something like that for the case you want to accept all files types…

In App. Add OpenDocument Event and place code there to handle file drop (in the Dock for example)…

Read for example:

and get back here if you still miss a piece of information.

Thank you very much for the docs reference @Emile_Schwarz

I’ve read all of the above documentation.
I posted because the documentations are too vague (to me) about how to accept all file types and how to make those accepted when dragged over the app icon on macOS and I was hoping someone here can explain it in layman’s terms.

The application works well and accepting file types under Windows, but it doesn’t accept ALL file types even after I added the IDE special/any built-in preset in the FileTypeGroup editor and added Me.AcceptFileDrop(FileTypeGroup.Any) in the Window.Open event.

Furthermore, I remember we had a listbox with all the FileTypeGroup items listed with checkboxes (in the macOS build settings), so we could specify which file types are accepted and can be handled in the App.OpenDocument event. I can’t see it anymore in Xojo 2020r2.1, and I don’t understand what is replacing it in any of the docs.
I did see this paragraph: “Use the File Type Set Editor to enter the file types and in the App object’s Properties pane, click the “…” button to open a dialog box in which you can edit this list”, it was written about the Application.AcceptFileTypes (macOS only). It sounds exactly what I’m looking for to accept the item path as an argument in the App.OpenDocument event, but unfortunately, I have no clue what it means and where to look for the App object’s Properties pane with the “…” in the IDE.

1 Like

If so, set a bug report.

Yes,it is not easy to find what we search in the doc.

Thank you @Emile_Schwarz , Yes I will open a bug report, I just thought maybe I’m doing something wrong…

What files types on Windows are rejected by special/any ?

Excellent question, It rejects all of them!
I didn’t notice at first because I had some specific file types configured, and those were fine, of course.

Just to clarify, on macOS the special/any works as expected apparently with Any file type, or at least all the ones I tried, so it looks like the issue/bug is Windows only.

Can anyone check if this issue still exists in the new 2021r1, I didn’t install it yet, I’m still using 2020r2.1

Okay, about my first query, I finally found my answer in the ‘File Type Group Editor’ docs where it say:

A properly set up file type and role enables these OS features:
• File selection dialogs can limit the selection of files
Opening a file or dropping a file onto the app’s Dock icon will automatically launch the app and pass the file to the App.OpenDocument event
• The File Type icon will appear in the Finder for files created by the app

So setting the Role to View or Edit had finally fixed the auto app launch by dropping a FolderItem onto the Dock icon. Excellent! (I have no idea then it was changed to this as it didn’t always been like this in the Xojo IDE)

Now I’m halfway there and I’m a bit stuck with an App that only works on macOS as expected :sob:

Windows is better at filtering dropped items… than what macOS actually do.

If I recall correctly, macOS may accept a folder drop even if you do not include them :(.

Now, I always check F;Type to the file types I accept or reject (depending on the project / if I want to accept only two or three or reject two or three).

I suspect your problem on Windows is with your custom file types…

Now I’m halfway there and I’m a bit stuck with an App that only works on macOS as expected :sob:
Until recently *, Windows worked as expected for me.
I trashed VirtualBox one year ago because of the lack of space in my internal SSD (it was a catch22 for me to keep 20 to 30 GB of free space in this f… 250GB boot SSD disk…)

And I do not talk about Linux… I do that three or four years ago, same reason.

I don’t follow Emile, what do you mean by custom file types?
Currently, the only file types I have configured are the special/any and it rejects every file type out there when running on Windows while works fine under macOS. you’re right about the fact that on Mac it will accept a folder drop even if you do not specifically ask for them, but it’s pretty standard for me to sort those with If FolderItem.IsFolder Then, so I have no problem with this. I always prefer to get too much than have something missing :wink:

If you’re on the feedback system, you can check Case-64384 for a full description and Repro steps.

So, it’s a bug.

I believe so.
I even installed 2021r1 to make sure before I opened the case. Works excellent under macOS, do nothing whatsoever under Windows.
The problem is, given that I’m right and it is really a bug, now it will take forever until the fix, and that means no Windows version for this software until that happens.
The only other option/workaround is to manually add all the file types I can think of, pretty crazy if you think about it.

Not mandatory. Sometimes we can be surprised…

As always, only time will tell.

1 Like

From your mouth to the gods of bugfix :pray: hahaha


If you report the file type of a dragged item, you define something (the name of the file type…).

Do you know what FolderItem.Type may do for you ?
Of course, you have to define a file type in order to get that information returned with FolderItem.Type.

Could you post a screenshot of the special/any file type you’ve created?

Of course, but I didn’t change anything from the default special/any built-in preset (except for the Role attribute for the App.OpenDocument handler), so you might as well do it yourself in any project.

Well, if I understand your point there’s no need for that, as I created a global function and named it “FileType” that Extends f As FolderItem and returns a String.

Var ft() As String = f.NativePath.Split(".")
If ft.Ubound > -1 Then
  Var Last As int16 = ft.Ubound
  Return ft(Last)
End If
Return ""

Call it from anywhere just by writing: obj.FolderItem.FileType
Works like a charm, as long as the app lets the folderitem in of course :slight_smile:

BTW, you can simplify that code to

Var name as string =
Return NthField(name, ".", CountFields(name, "."))
1 Like

Ok, I seem to remember that there’s something special that you need to do on Windows, but trying to remember what that is.