Make iPhone Simulator case sensitive on file access
It's known that when accessing files in iPhone simulator the case of chars doesn't matter. Is it possible to setup iPhone Simulator to not ignore cases?
Otherwise I can compare file开发者_开发技巧 path from my code with file path from disk. Then what method to use to get real file path with right cases corresponding to file path from code?
I solved with script on build phase:
echo "list all files in [$FULL_PRODUCT_NAME]"
cd "$CODESIGNING_FOLDER_PATH"
find . -type f > "$CODESIGNING_FOLDER_PATH"/filelist.txt
And added some code to find file path in filelist.txt:
BOOL file_found = NO;
for (NSString* file_path in AllFilesList) // AllFilesList keeps list from allfiles.txt
{
if ([file_path rangeOfString: relPath].location == 2) // 2 because all paths start with './'
{
file_found = YES;
break;
}
}
if (!file_found)
{
NSLog (@"!!! ERROR !!! file not found: [%@]", relPath);
for (NSString* file_path in AllFilesList)
{
if ([file_path rangeOfString: relPath options: NSCaseInsensitiveSearch].location == 2)
{
NSLog (@" corresponding file may be: [%@]", relPath);
break;
}
}
}
Did you report the bug to Apple? iPhone simulator should be case sensitive the same way the devices are.
精彩评论