[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32243] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: OSX/Cocoa: Fix [#24068] for correct handling of . blend file names with accented nordic characters

Damien Plisson damien.plisson at yahoo.fr
Sat Oct 2 11:17:32 CEST 2010


Revision: 32243
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32243
Author:   damien78
Date:     2010-10-02 11:17:32 +0200 (Sat, 02 Oct 2010)

Log Message:
-----------
OSX/Cocoa: Fix [#24068] for correct handling of .blend file names with accented nordic characters

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-10-02 09:15:32 UTC (rev 32242)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-10-02 09:17:32 UTC (rev 32243)
@@ -493,10 +493,10 @@
     GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid")
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-	NSString *windowTitle = [[NSString alloc] initWithUTF8String:title];
+	NSString *windowTitle = [[NSString alloc] initWithCString:title encoding:NSISOLatin1StringEncoding];
 	
 	//Set associated file if applicable
-	if ([windowTitle hasPrefix:@"Blender"])
+	if (windowTitle && [windowTitle hasPrefix:@"Blender"])
 	{
 		NSRange fileStrRange;
 		NSString *associatedFileName;
@@ -509,13 +509,16 @@
 		{
 			fileStrRange.length = len;
 			associatedFileName = [windowTitle substringWithRange:fileStrRange];
+			[m_window setTitle:[associatedFileName lastPathComponent]];
+
+			//Blender used file open/save functions converte file names into legal URL ones
+			associatedFileName = [associatedFileName stringByAddingPercentEscapesUsingEncoding:NSISOLatin1StringEncoding];
 			@try {
 				[m_window setRepresentedFilename:associatedFileName];
 			}
 			@catch (NSException * e) {
 				printf("\nInvalid file path given in window title");
 			}
-			[m_window setTitle:[associatedFileName lastPathComponent]];
 		}
 		else {
 			[m_window setTitle:windowTitle];





More information about the Bf-blender-cvs mailing list