开发者

Make iPhone Simulator case sensitive on file access

开发者 https://www.devze.com 2023-03-03 21:53 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号