0

Is there any way of getting folder path (any folder and can be at any location in mac) programatically, in a native cocoa application?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Pravara Patil
  • 513
  • 1
  • 3
  • 10
  • Are you looking for a way to list the file system's directories to find the one you need? – waldrumpus Jul 20 '12 at 10:43
  • Clarify your question. Do you mean by finding all the folders that have the same name, or are you trying to let the user choose a directory? – TheAmateurProgrammer Jul 20 '12 at 11:07
  • I want to search for a folder on the disk and access all the files and subdirectories within it. I don't want to hard code it, as user can store the directory anywhere in the file system. I hope I am clear this time. – Pravara Patil Jul 20 '12 at 11:14

1 Answers1

0

What exactly are you trying to achieve? Did you have a look at NSFileManager? To let the user choose a directory have a look at NSOpenPanel.

  • I have tried NSFileManager. It gives path for Documents / Application /User directories in the file structure. I want the folder that can be either in Home directory or in Application Directory. Basically, I want to check the whole file system to check for the folder and then access it's contents. However, Accessing contents is not a problem, I am stuck at searching the folder in the system. – Pravara Patil Jul 20 '12 at 11:37
  • Or maybe this will help: [link](http://stackoverflow.com/questions/3719010/using-spotlight-in-cocoa) – user1262430 Jul 20 '12 at 12:20