mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Fix OS X build failure due to a deprecated method.
Apple upgraded me to Xcode 7 yesterday, and now [NSString cString] gives a deprecation warning, which -Werror turns into a full-on build failure. Explicitly specify an encoding. (I mention in a comment that there's an alternative piece of API that I possibly ought to be using instead, but until I make a concrete decision about where my backwards compatibility threshold is, I'll leave it as it is for the moment.)
This commit is contained in:
19
osx.m
19
osx.m
@ -761,7 +761,24 @@ struct frontend {
|
||||
[op setAllowsMultipleSelection:NO];
|
||||
|
||||
if ([op runModalForTypes:nil] == NSOKButton) {
|
||||
const char *name = [[[op filenames] objectAtIndex:0] cString];
|
||||
/*
|
||||
* This used to be
|
||||
*
|
||||
* [[[op filenames] objectAtIndex:0] cString]
|
||||
*
|
||||
* but the plain cString method became deprecated and Xcode 7
|
||||
* started complaining about it. Since OS X 10.9 we can
|
||||
* apparently use the more modern API
|
||||
*
|
||||
* [[[op URLs] objectAtIndex:0] fileSystemRepresentation]
|
||||
*
|
||||
* but the alternative below still compiles with Xcode 7 and
|
||||
* is a bit more backwards compatible, so I'll try it for the
|
||||
* moment.
|
||||
*/
|
||||
const char *name = [[[op filenames] objectAtIndex:0]
|
||||
cStringUsingEncoding:
|
||||
[NSString defaultCStringEncoding]];
|
||||
char *err;
|
||||
|
||||
FILE *fp = fopen(name, "r");
|
||||
|
Reference in New Issue
Block a user