From d9f1f917c46c8faa4ac02f496d20487882e7f010 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Thu, 16 Jan 2014 21:57:58 +0400 Subject: Xcode: Remove dead code Variable 'ext' already checked for equality to "xib" so remove the branch that will never be executed. --- Source/cmGlobalXCodeGenerator.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index f7a42fc..82466c9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -778,10 +778,6 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, { sourcecode += ".c.objc"; } - else if(ext == "xib") - { - sourcecode += ".file.xib"; - } else if(ext == "plist") { sourcecode += ".text.plist"; -- cgit v0.12 From 1ce02ebfd57da6e58b77399648ec758c2f812656 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Thu, 16 Jan 2014 22:16:34 +0400 Subject: Xcode: Fix storyboard view Images and xib files must have 'lastKnownFileType' attribute to be displayed correctly. If xib file has attribute 'explicitFileType' it is displayed as raw xml. If static image has attribute 'explicitFileType' it is displayed as question mark on storyboard. --- Source/cmGlobalXCodeGenerator.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 82466c9..41961ed 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -753,7 +753,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, //---------------------------------------------------------------------------- std::string GetSourcecodeValueFromFileExtension(const std::string& _ext, - const std::string& lang) + const std::string& lang, + bool& keepLastKnownFileType) { std::string ext = cmSystemTools::LowerCase(_ext); std::string sourcecode = "sourcecode"; @@ -764,10 +765,12 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, } else if(ext == "xib") { + keepLastKnownFileType = true; sourcecode = "file.xib"; } else if(ext == "storyboard") { + keepLastKnownFileType = true; sourcecode = "file.storyboard"; } else if(ext == "mm") @@ -793,6 +796,7 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext, } else if(ext == "png" || ext == "gif" || ext == "jpg") { + keepLastKnownFileType = true; sourcecode = "image"; } else if(ext == "txt") @@ -871,8 +875,10 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( } else { - std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, lang); - const char* attribute = (sourcecode == "file.storyboard") ? + bool keepLastKnownFileType = false; + std::string sourcecode = GetSourcecodeValueFromFileExtension(ext, + lang, keepLastKnownFileType); + const char* attribute = keepLastKnownFileType ? "lastKnownFileType" : "explicitFileType"; fileRef->AddAttribute(attribute, -- cgit v0.12