• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie: Current Apps Directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Current Apps Directory


  • Subject: Re: Newbie: Current Apps Directory
  • From: publiclook <email@hidden>
  • Date: Tue, 15 Apr 2003 19:53:49 -0400

Please don't make applications that do this sort of thing. Just put the data file in the application bundle and access it via NSBundle's -pathForResource:ofType: or put the data file in a ~/Libary/ApplicationSupport directory. Don't search the entire Applications directory or clutter file systems with random data files. This is just my opinion, and I don't mean to be insulting. I am just expressing my (and I think Apple's) wishes.

On Tuesday, April 15, 2003, at 04:40 PM, Craig Bakalian wrote:

On Tuesday, April 15, 2003, at 03:31 PM,
email@hidden wrote:

I'm doing a quick little drag and drop utility that has template files
next to it that I need to read. I have things set up to be flexible
enough to change which template files to use, but as a default, I would
like it to read the ones that are right next to it. ( html files )
( worst comes to worst I'll set it up in a preference, and have to set
it up the first time I use it, but I'd rather not do anything extra,
since one can easily change it if the initial suggestion is not good )
-- which in my case it is.

Hi,

I had the same problem a day ago. This was the solution ->

-(void) someFunction
{
NSString *file;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator;
NSString *bun = [[NSBundle mainBundle] bundlePath];
NSString *p = [bun stringByAppendingPathComponent: @"/.."];
if([fileManager changeCurrentDirectoryPath: p])
{
enumerator = [fileManager enumeratorAtPath: [fileManager
currentDirectoryPath]];
while(nil != (file = [enumerator nextObject]))
{

}
}
}

The [[NSBundle mainBundle] bundlePath] gets the apps bundle path, the
@"/.." shoots the directory up.
The enumerator just chugs through all in the directory. You just need
to set the currentDirectoryPath before you use it. The name
currentDirectoryPath is misleading.


Craig Bakalian
www.eThinkingCap.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Newbie: Current Apps Directory
      • From: Andres Ramirez <email@hidden>
    • Basic concepts help. making IB connection to a specific instance
      • From: Denis Stanton <email@hidden>
    • Re: Newbie: Current Apps Directory
      • From: Craig Bakalian <email@hidden>
References: 
 >Re: Newbie: Current Apps Directory (From: Craig Bakalian <email@hidden>)

  • Prev by Date: Re: Inconsistent Memory Management Rules
  • Next by Date: Re: Newbie: Current Apps Directory
  • Previous by thread: Re: Newbie: Current Apps Directory
  • Next by thread: Re: Newbie: Current Apps Directory
  • Index(es):
    • Date
    • Thread