Giter Site home page Giter Site logo

Comments (4)

YvesR avatar YvesR commented on September 27, 2024 1

@jbtule I had the same issue, thought it is catalina, but 3.1 fixed the issue. Works now again.

from cdto.

mlfarrell avatar mlfarrell commented on September 27, 2024

Looks like this fixed it. At least mostly

    @autoreleasepool {
        // Setup code that might create autoreleased objects goes here.
        FinderApplication* finder = [SBApplication applicationWithBundleIdentifier:@"com.apple.Finder"];
        TerminalApplication* terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.Terminal"];
                        
        FinderItem *target = [(NSArray*)[[finder selection] get] firstObject];
        if (target == nil){
            target = [[[[finder FinderWindows] objectAtLocation:@0] target] get];
        }
        
        if ([[target kind] isEqualToString:@"Alias"]){
            target = (FinderItem*)[(FinderAliasFile*)target originalItem];
        }
        NSString* fileUrl = [target URL];
        
        if(fileUrl != nil && ![fileUrl hasSuffix:@"/"]){
            fileUrl = [fileUrl stringByDeletingLastPathComponent];
        }
        
        NSURL* url = [NSURL URLWithString:fileUrl];
                
        if (url != nil){
            [terminal activate];
            [terminal open:@[url]];
        } else {
            SBElementArray *finderWindows = finder.FinderWindows;
            FinderWindow *finderWindow = finderWindows.firstObject;
            FinderFolder *finderFolder = finderWindow.properties[@"target"];
            
            fileUrl = finderFolder.URL;
            url = [NSURL URLWithString:fileUrl];
            
            if(fileUrl)
            {
                [terminal activate];
                [terminal open:@[url]];
            }
        }
    }
}

from cdto.

jbtule avatar jbtule commented on September 27, 2024

I think the problem was

            target = [[[[finder FinderWindows] objectAtLocation:@0] target] get];

As apple script collection is not zero based!! whoops!!

Since it looks like you've already tried the source, can you try pull request #42 see if it fixes it.

Thank you!

from cdto.

jbtule avatar jbtule commented on September 27, 2024

Released 3.1, let me know if this fixes your issue. Thanks.

https://github.com/jbtule/cdto/releases/tag/v3.1

from cdto.

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.