By Tyler Bell


2012-08-01 18:44:12 8 Comments

The directory that was dragged will then open in the application it was dragged to (if the app accepts the path). What happens at the low level?

How does the application know it can open that path? How does Finder provide the application with the path to open?

1 comments

@bmike 2012-08-01 18:48:31

At a low level, everything on the disk is a file. So a folder is a special file that contains directory information pointing to more files.

The application is told that the file should be opened - and it's up to the program to determine what type of file was passed and decide whether to recursively handle that file by reading the files contained in that folder or take some other action.

Similarly, you can select many items in Finder and drop them on an icon and the same sort of file open event is posted to the application so that it can process the files and do what needs to be done.

@Tyler Bell 2012-08-01 18:50:28

Thank you for the response, @bmike, that makes sense! How would one go about telling an app (using a script or something along those lines) to do a general "Open" command on a path?

@robmathers 2012-08-01 18:59:03

This might be useful as a separate question, but in a bash script you could do open -a Application /path/to/open

@Travis Northcutt 2012-08-01 19:04:23

Also, @TylerBell, you can simply use open /path/to/file on the command line/in a script, and the file will be opened with the default application for that file type. For directories, that's Finder.

@Tyler Bell 2012-08-01 19:10:36

You all are awesome, thank you for the great answers @tnorthcutt

@Travis Northcutt 2012-08-01 19:15:44

@TylerBell you're welcome. I see you're new here; don't forget to upvote helpful answers and comments and mark an answer as accepted if it answers your question.

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Stop Finder from creating aliases when moving Applications

  • 2015-11-08 02:15:27
  • Wowfunhappy
  • 1827 View
  • 2 Score
  • 2 Answer
  • Tags:   finder alias

2 Answered Questions

[SOLVED] Finder Icon to Go to Enclosing Directory

  • 2018-06-25 18:21:24
  • ericlindellnyc
  • 246 View
  • 0 Score
  • 2 Answer
  • Tags:   finder navigation

1 Answered Questions

[SOLVED] Hammerspoon get working directory from finder

2 Answered Questions

[SOLVED] How can I replace Finder with Path Finder in OS X Lion?

  • 2012-05-14 21:05:44
  • jclancy
  • 4060 View
  • 5 Score
  • 2 Answer
  • Tags:   lion finder

3 Answered Questions

[SOLVED] What happens at the user/OS level when an SSD finally wears out?

  • 2011-05-10 21:12:24
  • bmike
  • 4343 View
  • 14 Score
  • 3 Answer
  • Tags:   hardware ssd macos

3 Answered Questions

[SOLVED] Finder shows stale directory listings from NFS server

  • 2013-02-16 21:09:03
  • smammy
  • 5433 View
  • 3 Score
  • 3 Answer
  • Tags:   macos finder nfs

2 Answered Questions

[SOLVED] Open arbitary file from Finder in TextMate

Sponsored Content