Commit 1ce02ebf authored by Ruslan Baratov's avatar Ruslan Baratov Committed by Brad King
Browse files

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.
parent d9f1f917
......@@ -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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment