opening file without an extension

  • I have an NSDocument subclass, and I want to open a data file that has no file extension. (It is BSM audit data, and there is no standard extension).

    The application is sandboxed.

    When the open panel pops up, all the regular files are greyed out.  Is there a way to let Powerbox (??) let the user select any file?

    Thanks,

    Todd
  • Does putting an asterisk (*) in the Extensions field for your document type not work in the sandbox?

    Charles

    On Jul 1, 2012, at 10:11 PM, Todd Heberlein wrote:

    > I have an NSDocument subclass, and I want to open a data file that has no file extension. (It is BSM audit data, and there is no standard extension).
    >
    > The application is sandboxed.
    >
    > When the open panel pops up, all the regular files are greyed out.  Is there a way to let Powerbox (??) let the user select any file?
    >
    > Thanks,
    >
    > Todd
  • On Jul 1, 2012, at 8:19 PM, Charles Srstka wrote:

    > Does putting an asterisk (*) in the Extensions field for your document type not work in the sandbox?

    Excellent!  Yes it did.

    Thanks.

    Todd
  • On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said:

    >> Does putting an asterisk (*) in the Extensions field for your document
    > type not work in the sandbox?
    >
    > Excellent!  Yes it did.

    Umm, why not just use the documented technique?

    setAllowedFileTypes: "A nil value indicates that all files should be enabled."

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
  • On Jul 4, 2012, at 2:40 PM, Sean McBride wrote:

    > On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said:
    >
    >>> Does putting an asterisk (*) in the Extensions field for your document
    >> type not work in the sandbox?
    >>
    >> Excellent!  Yes it did.
    >
    > Umm, why not just use the documented technique?

    Because that’s exactly what this is?

    http://developer.apple.com/library/mac/#documentation/general/Reference/Inf
    oPlistKeyReference/Articles/CoreFoundationKeys.html%23//apple_ref/doc/uid/2
    0001431-101705


    > setAllowedFileTypes: "A nil value indicates that all files should be enabled.”

    Maybe because he’s using Cocoa’s built-in document support instead of manipulating the NSOpenPanel directly?

    Charles
  • On Jul 4, 2012, at 12:54 PM, Charles Srstka wrote:

    > On Jul 4, 2012, at 2:40 PM, Sean McBride wrote:
    >
    >> On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said:
    >>
    >>>> Does putting an asterisk (*) in the Extensions field for your document
    >>> type not work in the sandbox?
    >>>
    >>> Excellent!  Yes it did.
    >>
    >> Umm, why not just use the documented technique?
    >
    > Because that’s exactly what this is?
    >
    > http://developer.apple.com/library/mac/#documentation/general/Reference/Inf
    oPlistKeyReference/Articles/CoreFoundationKeys.html%23//apple_ref/doc/uid/2
    0001431-101705


    As the documentation states, you should not be using the Extensions field (which maps to CFBundleTypeExtensions), as they have been deprecated in Mac OS X 10.5. Use UTIs instead.

    --Kyle Sluder
  • On Wed, 4 Jul 2012 14:54:54 -0500, Charles Srstka said:

    >> Umm, why not just use the documented technique?
    >
    > Because that’s exactly what this is?
    >
    > http://developer.apple.com/library/mac/#documentation/general/Reference/
    > InfoPlistKeyReference/Articles/CoreFoundationKeys.html%23//apple_ref/doc/
    > uid/20001431-101705
    >
    >> setAllowedFileTypes: "A nil value indicates that all files should be
    > enabled.”
    >
    > Maybe because he’s using Cocoa’s built-in document support instead of
    > manipulating the NSOpenPanel directly?

    Ah, I missed the NSDocument bit, though the OP did ask: "Is there a way to let Powerbox (??) let the user select any file?"

    CFBundleTypeExtensions is deprecated though.  Probably using kUTTypeData aka public.data is more appropriate.

    --
    ____________________________________________________________
    Sean McBride, B. Eng                <sean...>
    Rogue Research                        www.rogue-research.com
    Mac Software Developer              Montréal, Québec, Canada
  • On Jul 4, 2012, at 3:03 PM, Kyle Sluder wrote:

    > On Jul 4, 2012, at 12:54 PM, Charles Srstka wrote:
    >
    >> On Jul 4, 2012, at 2:40 PM, Sean McBride wrote:
    >>
    >>> On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said:
    >>>
    >>>>> Does putting an asterisk (*) in the Extensions field for your document
    >>>> type not work in the sandbox?
    >>>>
    >>>> Excellent!  Yes it did.
    >>>
    >>> Umm, why not just use the documented technique?
    >>
    >> Because that’s exactly what this is?
    >>
    >> http://developer.apple.com/library/mac/#documentation/general/Reference/Inf
    oPlistKeyReference/Articles/CoreFoundationKeys.html%23//apple_ref/doc/uid/2
    0001431-101705

    >
    > As the documentation states, you should not be using the Extensions field (which maps to CFBundleTypeExtensions), as they have been deprecated in Mac OS X 10.5. Use UTIs instead.

    For the general case, you want to use UTIs instead of extensions; however, this is a special case, and there’s not really an equivalent way to do this with UTIs. In theory, registering for public.data should work, but at least when I tried this about a year ago, it caused the Finder to do some really strange things. I can’t really remember the details anymore, but I do remember that the beta testers were screaming. If you look at Xcode’s Info.plist to see how they registered as a handler for all files, you will see that they put * for CFBundleTypeExtensions; that’s a good enough sign to me that that’s how we should do it, for now at least.

    Charles
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today