More cString cleanups.

I don't know that fileSystemRepresentation is any better than cString for
general usage (due to wchar on windows).
This commit is contained in:
Bill Currie 2010-12-28 07:42:08 +09:00
parent d29e8deb0a
commit 7946fec523
3 changed files with 9 additions and 4 deletions

View file

@ -176,6 +176,7 @@ scanFile
{
int size, line;
const char *data;
const char *fname;
id cl;
int i;
NSString *path;
@ -184,6 +185,7 @@ scanFile
path = [source_path stringByAppendingPathComponent: filename];
contents = [fm contentsAtPath: path];
fname = [filename fileSystemRepresentation];
if (!contents)
return;
@ -195,7 +197,7 @@ scanFile
if (!strncmp (data + i, "/*QUAKED", 8)) {
cl = [[EntityClass alloc]
initFromText: (data + i)
source: va ("%s:%d", [filename cString], line)];
source: va ("%s:%d", fname, line)];
if (cl)
[self insertEC: cl];
} else if (data[i] == '\n') {

View file

@ -254,7 +254,7 @@ readMapFile
dat[size] = 0;
script = Script_New ();
Script_Start (script, [fname cString], dat);
Script_Start (script, [fname fileSystemRepresentation], dat);
do {
new = [[Entity alloc] initFromScript: script];

View file

@ -695,7 +695,9 @@ saveBSP
[[[mappath lastPathComponent] stringByDeletingPathExtension]
stringByAppendingPathExtension: @"bsp"]];
ExpandCommand (cmdline, expandedcmd, [mappath cString], [bsppath cString]);
ExpandCommand (cmdline, expandedcmd,
[mappath fileSystemRepresentation],
[bsppath fileSystemRepresentation]);
strcat (expandedcmd, " > ");
strcat (expandedcmd, FN_CMDOUT);
@ -828,6 +830,7 @@ save:
- (id) save: sender;
{
NSString *backup;
NSFileManager *fm = [NSFileManager defaultManager];
// force a name change if using tempname
if (![filename compare: FN_TEMPSAVE])
@ -836,7 +839,7 @@ save:
backup = [[filename stringByDeletingPathExtension]
stringByAppendingPathExtension: @"bak"];
rename ([filename cString], [backup cString]); // copy old to .bak
[fm copyPath: filename toPath: backup handler: nil]; // copy old to .bak
[map_i writeMapFile: filename useRegion: NO];