diff options
author | Damien Plisson <damien.plisson@yahoo.fr> | 2010-10-02 13:17:32 +0400 |
---|---|---|
committer | Damien Plisson <damien.plisson@yahoo.fr> | 2010-10-02 13:17:32 +0400 |
commit | b6bdf681fbe7f223a3f469490514501a580aedd5 (patch) | |
tree | c4c8b0be8a2618455f5ee5759e19e8713b3db137 /intern | |
parent | af8ae62ec0df083416ae55d363f1bb4b8b059d27 (diff) |
OSX/Cocoa: Fix [#24068] for correct handling of .blend file names with accented nordic characters
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index aed9bd07cdc..c43a9b57721 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -493,10 +493,10 @@ void GHOST_WindowCocoa::setTitle(const STR_String& title) 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 @@ void GHOST_WindowCocoa::setTitle(const STR_String& title) { 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]; |