Why do I get a capitalized extension?
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