Fix problem with coding on Windows.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@37784 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Germán Arias 2014-04-03 00:56:52 +00:00
parent 6021cce07b
commit ae84c3ad36
3 changed files with 34 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2014-04-02 German Arias <germanandre@gmx.es>
* Framework/PCFileCreator.m (-replaceTagsInFileAtPath:withProject:):
Ensure UTF-8 when read and write a file in Windows.
* Modules/Editors/ProjectCenter/PCEditorView.m (-insertText:): Ensure
UTF-8 when insert a text in Windows.
2014-04-02 German Arias <germanandre@gmx.es>
* Framework/English.lproj/SaveModified.gorm: Use class PCAuxiliaryWindow

View file

@ -278,7 +278,13 @@ static NSDictionary *dict = nil;
NSString *fn = [aFile stringByDeletingPathExtension];
NSRange subRange;
#ifdef WIN32
file = [[NSMutableString stringWithContentsOfFile: newFile
encoding: NSUTF8StringEncoding
error: NULL] retain];
#else
file = [[NSMutableString stringWithContentsOfFile:newFile] retain];
#endif
while ((subRange = [file rangeOfString:@"$FULLFILENAME$"]).length)
{
@ -321,8 +327,14 @@ static NSDictionary *dict = nil;
withString:[[NSNumber numberWithInt:year] stringValue]];
}
#ifdef WIN32
[file writeToFile: newFile
atomically: YES
encoding: NSUTF8StringEncoding
error: NULL];
#else
[file writeToFile:newFile atomically:YES];
#endif
[file release];
}

View file

@ -519,7 +519,12 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
memset(&buf[1], ' ', offset);
buf[offset+1] = '\0';
[super insertText:[NSString stringWithCString:buf]];
#ifdef WIN32
[super insertText:[NSString stringWithCString: buf
encoding: NSUTF8StringEncoding]];
#else
[super insertText:[NSString stringWithCString:buf]];
#endif
free(buf);
/* }
else
@ -558,12 +563,20 @@ static int ComputeIndentingOffset(NSString * string, unsigned int start)
}
else
{
#ifdef WIN32
[super insertText: [NSString stringWithCString: [text UTF8String]]];
#else
[super insertText: text];
#endif
}
}
else
{
#ifdef WIN32
[super insertText: [NSString stringWithCString: [text UTF8String]]];
#else
[super insertText: text];
#endif
}
}