finder

How to check whether directories with a given extension are shown by the Finder as a package?

泄露秘密 提交于 2019-12-06 23:48:35
For a given extension, how do you check whether directories with that extension will be shown by the Finder as a package? I figured the method below is an effective implementation for this, but creating a temporary directory feels like a hack. I'm guessing I should be able to implement this properly through the Launch Services API , but I can't quite figure out how to do it (I might be overlooking the obvious though). // Extension method on NSWorkspace @implementation NSWorkspace (MyExtraMethods) - (BOOL) isPackageExtension: (NSString*) extension { NSString * pathToTemp = [NSTemporaryDirectory

Applescript Finder path into POSIX path

允我心安 提交于 2019-12-06 16:12:05
I'm running the following applescript: tell application "Finder" set input to POSIX file "/Users/sam/Desktop/Resized" set theFiles to (every file of folder input whose name does not contain "- Resized") end tell return theFiles It's working as it should, though it's returning: {document file "HighResCat.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder", document file "madonna.jpg" of folder "Resized" of folder "Desktop" of folder "sam" of folder "Users" of startup disk of application "Finder"} where I need a POSIX path (

Getting the POSIX path of the Finder's front window

末鹿安然 提交于 2019-12-06 08:47:08
问题 How can I get the POSIX path of the Finder window that is currently at the top of its window list? Preferably with some kind of Cocoa framework but I am open for anything. Background: I would need this because I want to make a selection of files matching a regex pattern, starting recursively from this path. The idea is to use [[NSWorkspace sharedWorkspace] subpathsAtPath:thePath] method to get all the descendants of this path, use "grep" in an NSTask (to avoid packaging a regex support

How can I implement gesture recognizers in OS X?

烂漫一生 提交于 2019-12-05 17:48:11
问题 I have done quite a bit with gesture recognizers for iOS, but I am now doing work in OS X, and I am lost. I want to duplicate the functionality that exists like in Finder where you can two-finger swipe (on your magic mouse) to go back/forward through a directory tree. I have an NSWindow based app that looks very similar to Finder. I have used apps before that allows you to build your own gesture recognizers so I know it is possible to do it, but I don't see any documentation on it. What do I

Trying to print every submodule inside a module in python

那年仲夏 提交于 2019-12-05 09:27:26
sorry if I got some facts wrong during this but I have only been programming for about a year, since I started a computing course at my school, and sorry if this question has been answered before I have looked everywhere but I don't know what to search for. Recently I found a game where you can use an injector to inject python code into it, but the only way of finding the codes is by using: import modulename print dir(modulename) and then print dir(modulename.submodulename) Which would print all the submodules inside that module to the log file of the game. Using this technique I have

How to refresh finder window?

喜你入骨 提交于 2019-12-05 04:33:21
问题 I want to refresh icon for particular file/folder in Finder application. FNNotifyByPath( (const UInt8 *)folderPath, kFNDirectoryModifiedMessage, kNilOptions ); FNNotifyByPath is not working for this. Now i am trying with appleScript +(void) refreshIconForItem : (NSString *)itemPath { NSString *source=[NSString stringWithFormat:@"tell application \"Finder\" to update \"%@\"",[NSString stringWithUTF8String:itemPath]]; NSAppleScript *update=[[NSAppleScript alloc] initWithSource:source];

Getting the POSIX path of the Finder's front window

旧巷老猫 提交于 2019-12-04 15:51:08
How can I get the POSIX path of the Finder window that is currently at the top of its window list? Preferably with some kind of Cocoa framework but I am open for anything. Background: I would need this because I want to make a selection of files matching a regex pattern, starting recursively from this path. The idea is to use [[NSWorkspace sharedWorkspace] subpathsAtPath:thePath] method to get all the descendants of this path, use "grep" in an NSTask (to avoid packaging a regex support framework) and use [[NSWorkspace sharedWorkspace] selectFile:aFile inFileViewerRootedAtPath:thePath] in a

How can I implement gesture recognizers in OS X?

淺唱寂寞╮ 提交于 2019-12-04 02:27:34
I have done quite a bit with gesture recognizers for iOS, but I am now doing work in OS X, and I am lost. I want to duplicate the functionality that exists like in Finder where you can two-finger swipe (on your magic mouse) to go back/forward through a directory tree. I have an NSWindow based app that looks very similar to Finder. I have used apps before that allows you to build your own gesture recognizers so I know it is possible to do it, but I don't see any documentation on it. What do I need to do to implement these gestures? You can read about Handling Trackpad Events in the Cocoa Event

Applescript: Open a Folder in Finder

拈花ヽ惹草 提交于 2019-12-04 00:23:37
I m trying to open a folder in Finder using AppleScript. The following is my code. I want the folder WorkSpace to open in Finder, but it opens the Parent Folder /Volumes/MyMacDrive/Mani and highlights the WorkSpace folder. I want the contents of WorkSpace folder, but all I'm getting is its Parent Folder's Contents. What am i missing here ..? property the_path : "/Volumes/MyMacDrive/Mani/WorkSpace/" set the_folder to (POSIX file the_path) as alias tell application "Finder" activate if window 1 exists then set target of window 1 to the_folder else reveal the_folder end if end tell Manikandaraj

告诉你如何在Finder里面显示隐藏文件

喜欢而已 提交于 2019-12-04 00:15:41
苹果Mac OS X操作系统下,隐藏文件是否显示有很多种设置方法,最简单的要算在Mac终端输入命令。显示/隐藏Mac隐藏文件命令如下(注意其中的空格并且区分大小写): defaults write com.apple.finder AppleShowAllFiles -bool true   如果想恢复隐藏,可以用这个命令:    defaults write com.apple.finder AppleShowAllFiles -bool false 显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles YES 隐藏Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles NO 输完单击Enter键,退出终端,重新启动Finder就可以了 重启Finder : 鼠标单击窗口左上角的苹果标志-->强制退出-->Finder-->重新开启 来源: oschina 链接: https://my.oschina.net/u/931254/blog/99475