Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make Visual Studio case sensitive on includes?

Windows is case insensitive for files, but Linux is sensitive. It's really annoying when you develop on Linux and notice that the Windows team doesn't care about that.

Is there a way to force Visual Studio to be case sensitive on include files?

I've read about solutions doing a compilation after every commit in a Linux server and notifying the developer, but I can't do it. I need a way to force Visual Studio to be case sensitive so the Windows team can fix it while they're developing.

like image 447
Pau Guillamon Avatar asked Apr 25 '14 08:04

Pau Guillamon


2 Answers

Since February 28, 2018 https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/ you can choose if a folder is case sensitive or not in windows.

fsutil.exe file setCaseSensitiveInfo <path> enable
fsutil.exe file setCaseSensitiveInfo <path> disable

the command does not work recursively if you want so you have to write something like that :

$directories = Get-ChildItem $path  -Recurse -Directory

ForEach($dir In $directories)
{
    fsutil.exe file setCaseSensitiveInfo $dir.FullName enable
}

One liner:

$directories = Get-ChildItem $path -Recurse -Directory ForEach($dir In $directories) { fsutil.exe file setCaseSensitiveInfo $dir.FullName enable }
like image 153
Cryckx Avatar answered Sep 29 '22 13:09

Cryckx


Case sensitivity doesn't depend on the compiler, but the underlying file system. So Linux may not be case sensitive, if the file system is remotely mounted on a Windows box, and vice versa. If you want to force case sensitivity on a Windows box, the only solution I know is to remote mount a file system on a Unix box.

Note that this shouldn't be a problem if you're developing on Linux, then moving to Windows. It's the reverse which is a problem. And the only real solution is to define and strictly enforce a naming convention. You need it for the code anyway (since C++ is case sensitive regardless). So if you have a class FxTrade, your coding conventions should insist that it is Fx, and not FX; these convensions must be enforced in the C++ code, or you'll go nuts having to look up each time which one it is, and the same code review that enforces them in the source should enforce them in the file names.

(And for what it's worth, it's a real pain to fix such an error under Subversion, since svn FXTrade.cpp FxTrade.cpp doesn't work under Windows; you have to move it to some other name, then commit, and then move it to the name you want.)

like image 40
James Kanze Avatar answered Sep 29 '22 12:09

James Kanze