Simulating case sensitivity on a filesystem that isn't case sensitive

拟墨画扇 提交于 2020-01-01 02:47:05

问题


When I develop in C++ on a filesystem that is not case sensitive, I miss problems such as

#include "File.h"

if on disk it is actually file.h.

The problem only appears when I eventually try to compile the code on a case sensitive filesystem.

How do I simulate case sensitivity on a filesystem (such as OSX's default) that isn't case sensitive?

Edit: I am looking for an automated solution, one that I can run now and in the future with "the push of a button".

It also appears to be perfectly good style to rigorously name files in C++ after the exact name of the class, including case. So SuperDuperClass would appear in SuperDuperClass.h. A solution that requires lowercasing filenames is not suitable.


回答1:


On Mac OS X, you can use Disk Utility to create a case-sensitive file system on a disk image.




回答2:


I'll just throw this out there. Only use lower case filenames. However, I am interested in a more complete and verifiable answer.




回答3:


I would be tempted to write something like FileMon (to run externally), and just monitor the file access calls from your IDE to the file system to check for case matches. It's unlikely you're going to get any automated checking from the IDE or the OS (at least, without mucking with the file system). On the other hand, a separate utility monitoring the file access could easily catch such issues (once you get over the hurtle of making the monitoring work).

My 2c, anyway.



来源:https://stackoverflow.com/questions/9595558/simulating-case-sensitivity-on-a-filesystem-that-isnt-case-sensitive

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!