• 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
Why isn't this working???? (NSURL and files)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why isn't this working???? (NSURL and files)


  • Subject: Why isn't this working???? (NSURL and files)
  • From: Francisco Tolmasky <email@hidden>
  • Date: Tue, 1 Apr 2003 18:35:27 -0800

I'm trying to work with NSURL, but for some reason it's not working.
WHen I convert from a string to an NSURL it isn't doing it or
something. Here is my code:

NSMutableDictionary *_assignmentTypesDictionary;

//...

+ (NSMutableDictionary *)types
{
if(!_assignmentTypesDictionary)
{
NSString *str= [[[NSFileManager defaultManager]
findSystemFolderType:kApplicationSupportFolderType
forDomain:kUserDomain] stringByAppendingString:@"types.gds"];
NSURL *typesFile= [NSURL URLWithString: [@"file://"
stringByAppendingString: str]];
if([[NSFileManager defaultManager] fileExistsAtPath: [typesFile
path]])
_assignmentTypesDictionary= [NSMutableDictionary
dictionaryWithContentsOfURL: typesFile];
else
{
_assignmentTypesDictionary= [[NSMutableDictionary alloc]
initWithObjectsAndKeys:
[NSColor redColor], @"Homework", [NSColor blueColor],
@"Quiz", [NSColor greenColor], @"Test",
[NSColor yellowColor], @"Lab", nil];
[_assignmentTypesDictionary writeToFile: [typesFile path]
atomically: YES];
}
}
return _assignmentTypesDictionary;
}

For some reason, it does not write the file, and if I say
NSLog([typesFile path]) nothing is printed. I've tried without
@"file://" and also with @"file:/". I've also tried using writeToURL
instead of writeToFile:.

Note: [[NSFileManager defaultManager]
findSystemFolderType:kApplicationSupportFolderType
forDomain:kUserDomain];

just returns @"Users/name/Library/Application\ Support/"

Also, is there any way of checking to see if a directory exists? And
how do u make directories?

Thank you in advance,

Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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: Why isn't this working???? (NSURL and files)
      • From: Dustin Voss <email@hidden>
    • Re: Why isn't this working???? (NSURL and files)
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Help for Help
  • Next by Date: Re: Right way to load initial data in controls when opening a window
  • Previous by thread: Re: Replacing a NSTextView's contents with NSDATA
  • Next by thread: Re: Why isn't this working???? (NSURL and files)
  • Index(es):
    • Date
    • Thread