Giter VIP home page Giter VIP logo

Comments (4)

lukaskollmer avatar lukaskollmer commented on August 30, 2024

where do you get the filePath from?

from objc.

erikjalevik avatar erikjalevik commented on August 30, 2024

Oh that's just a local string to a full, absolute path.

For this test, I used:

/Users/ejal/dev/filur/sandbox/test target/.gitignore

from objc.

lukaskollmer avatar lukaskollmer commented on August 30, 2024
  1. i found the bug and fixed it (the new version is already pushed to npm, not sure how long it takes to propagate but you can fix it for the time being by using this workaround):
// instead of objc.ns([nsUrl]);
const nsArray = NSMutableArray.array();
nsArray.addObject_(nsUrl);
  1. you probably should replace the -[NSWorkspace recycleURLs:completionHandler:] call with -[NSFileManager trashItemAtURL:resultingItemURL:error:]. The first one is asynchronous and requires a properly set up run loop (which you'd need to do manually and which probably wouldn't be trivial). The NSFileManager one is synchronous, which means that you can simply call it w/out having to implement anything else to make it work:
const trashUrl = objc.allocRef();
const error    = objc.allocRef();
const success  = NSFileManager.defaultManager().trashItemAtURL_resultingItemURL_error_(nsUrl, trashUrl, error);

from objc.

erikjalevik avatar erikjalevik commented on August 30, 2024

Amazing. Thanks for the quick turnaround.

I verified that both the NSMutableArray approach and the updated 0.16 version work.

Thanks for the hint about NSFileManager too. Seems like it's the more modern approach.

👍

from objc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.