Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

APIs to open a folder with file pre-selected #244

Merged
merged 3 commits into from
May 14, 2013
Merged

Conversation

peterflynn
Copy link
Member

This will enable a nice "Show in Finder"/"Show in Explorer" command in Brackets core.

gruehle and others added 3 commits April 29, 2013 17:51
…ead of the folder within the parent. This commit keeps the current functionality for files, where the parent folder is opened and the file is selected.
too - opening the parent folder with that file already selected. (The Mac
counterpart of this is already done in 1a3b149).
@peterflynn
Copy link
Member Author

@redmunds for review

@ghost ghost assigned redmunds May 14, 2013
@peterflynn
Copy link
Member Author

This goes with pull adobe/brackets#2128 on the JS side, so you could sync to that branch to test this out. But you can also test it fairly easily by just invoking brackets.app.showOSFolder() from the dev tools console.

[[NSWorkspace sharedWorkspace] openFile:filepath];
} else {
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:[NSArray arrayWithObject: [NSURL fileURLWithPath: filepath]]];
}
return NO_ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return values from openFile and activateFileViewerSelectingURLs are ignored. Should they be propagated back to Brackets? At the very least we could write something to the console.

Same comment on the Windows side.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activateFileViewerSelectingURLs doesn't have a return value. openFile does return YES or NO, but in my testing, the fileExistsAtPath check above catches the only possible error.

Same thing on Windows with the GetFileAttributes() check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just opening File Explorer or Finder, so I guess there's not much we can do after verifying file or folder exists.

@redmunds
Copy link
Contributor

Done with review.

@redmunds
Copy link
Contributor

Looks good. Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants