• 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 do I get a capitalized extension?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why do I get a capitalized extension?


  • Subject: Why do I get a capitalized extension?
  • From: Paul Johnson <email@hidden>
  • Date: Mon, 30 Aug 2010 15:31:55 -0500

I have some program initialization code that creates an SQLlite database or an XML file depending on a switch I set. The following code snippet is what I had originally:

#define SQLITE  1

<snip>

NSString *STORE_TYPE;

if (outputType == SQLITE) {

STORE_TYPE = NSSQLiteStoreType;

} else {

STORE_TYPE = NSXMLStoreType;

}

NSString *path = @"MyFile";

NSURL *url;

        if (outputType == SQLITE) {

url = "" fileURLWithPath:[path stringByAppendingPathExtension:@"sqlite"]];

} else {

url = "" fileURLWithPath:[path stringByAppendingPathExtension:@"xml"]];

}

 

      

NSError *error;

  NSPersistentStore *newStore = [coordinator addPersistentStoreWithType:STORE_TYPE

                                                          configuration:nil

                                                                    URL:url

                                                                options:nil

                                                                  error:&error];


When I run the program I create a file  "MyFile.sqlite" with an extension of "sqlite" as expected, but thinking I could simplify the code I replaced the second "if-else" block with simply

  url = "">NSURL fileURLWithPath:[path stringByAppendingPathExtension:STORE_TYPE]];


With this change I create a file "MyFile.SQLITE". The extension has become uppercase. If I display STORE_TYPE in the debugger it shows up as "sqlite".

Can anyone explain how I can getting the file extension changed to all caps? (BTW, it appears that extensions are case insensitive, but maybe someone can also confirm that.)

Thanks for looking at this.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why do I get a capitalized extension?
      • From: "Sean McBride" <email@hidden>
    • Re: Why do I get a capitalized extension?
      • From: Ulf Dunkel <email@hidden>
  • Prev by Date: Can't bring debugger using default shortcut key
  • Next by Date: Re: Why do I get a capitalized extension?
  • Previous by thread: Can't bring debugger using default shortcut key
  • Next by thread: Re: Why do I get a capitalized extension?
  • Index(es):
    • Date
    • Thread