[MacRuby-devel] NSWorkspace.sharedWorkspace.recycleURLs:completionHandler doing nothing under macruby

Caio Chassot lists at caiochassot.com
Tue Aug 2 02:46:14 PDT 2011


NSWorkspace.sharedWorkspace.recycleURLs:completionHandler: fails for
me when run via normal macruby, yet works in macirb.

Sample code:

    #!/usr/bin/env macruby
    framework 'Cocoa'
    path = "#{ENV['HOME']}/Desktop/Y-U-NO-TRASH-ME-MACRUBY.txt"
    system "touch #{path}"
    url  = NSURL.fileURLWithPath(path)
    urls = [url]
    NSWorkspace.sharedWorkspace.recycleURLs(urls, completionHandler:nil)
    puts "Should be false: #{File.exists?(path)}"

  (or: https://gist.github.com/960048c72a9b55db40b3)

Output from running it:

    $ macirb foo.rb
    # … irb output elided
    Should be false: false

    $ macruby foo.rb
    Should be false: true

Running on public release of Lion, clean install, with latest macruby
nightly, bridgesupport preview 3.

The equivalent code works fine in Nu.


More information about the MacRuby-devel mailing list