Xcode: Refactor internal file type extension extraction

Move it earlier so it can be used for directories too.
This commit is contained in:
Brad King 2014-09-03 10:33:12 -04:00
parent fb8acb74e8
commit 02aa5965e6
1 changed files with 7 additions and 7 deletions

View File

@ -864,6 +864,13 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
}
if(fileType.empty())
{
// Compute the extension without leading '.'.
std::string ext = cmSystemTools::GetFilenameLastExtension(fullpath);
if(!ext.empty())
{
ext = ext.substr(1);
}
// If fullpath references a directory, then we need to specify
// lastKnownFileType as folder in order for Xcode to be able to
// open the contents of the folder.
@ -875,13 +882,6 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
}
else
{
// Compute the extension without leading '.'.
std::string ext = cmSystemTools::GetFilenameLastExtension(fullpath);
if(!ext.empty())
{
ext = ext.substr(1);
}
fileType = GetSourcecodeValueFromFileExtension(
ext, lang, useLastKnownFileType);
}