rs.OpenFileName file filter problem

Hi @Alain,

i’m not sure if this could be called a bug but rs.OpenFileName seems to allow me to select an *.url file instead of an *.svg file in below example code:

import rhinoscriptsyntax as rs

file = rs.OpenFileName("Open", "SVG Files (*.svg)|*.svg||")
print file

Could this be improved so it does only show the files having the extensions defined in the filter attribute ? Or is this maybe on purpose as the url could point to an svg file ?

thanks,
c.

Hi,
Usually a user can override a filter in the dialog by typing “*.url”. Is that what you mean?

Hi @Alain.

no, i was trying to prevent that the user is allowed to pick anything else than svg and wondering why it allows me url files to be picked in the dialog at all. I did not type anything, just picked it from the list of files in the dialog.

_
c.

Hi @clement,

Seems to work as expected on Windows both V7 and V8. Are you testing on the Mac?

– Dale

Hi @dale, no windows. I can select and open an url file using Rhino 7 and 8.

_
c.

If I run the script and navigate to a folder with .svg and .url files, I only see the .svg files…

Hi @dale, below is what i can do under windows 10:

OpenFileNameBug

Imho, it should not list the url file nor should it allow to select it.

_
c.

@clement - from what I’ve been able to dig up, the Windows’ Open File common dialog does show Internet Shortcuts along with folders. I have no idea why, but it does. And it happens in other Windows apps (Notepad).

There is probably a way to hack around this. I’m sure it’s a lot of work.

– Dale

thanks @dale,

i’ll just add a check for the extension after the file has been selected and cancel the command if required.
_
c.