I have a couple of libraries that are built for Linux and windows. The Linux version builds via a Makefile
in the root directory, and the Windows version is a Visual Studio 2010 project that uses the exact same source files. Platform-specific code is handled in a hardware abstraction layer header (.h
) file which handles things like strtok_s()
versus strtok_r()
, Visual Studio's C89 limitations, etc.
In order to reduce the headache my devs have when dealing with SVN, I ran a batch script on a Linux box to convert the line endings for all the source .c
, .h
, and .cpp
files to Linux (LF
), set the svn property for line endings to "native" (ie: svn propset eol-style:native
), and commited all the files in one large commit.
No issues on the Linux side of things, but whenever the Windows users check out the file (they are using TortoiseSVN), make changes, and generate the diff/patch, TortoiseSVN complains about inconsistent line endings. I verified with GVim on Windows, and it seems the files all have UNIX style (LF
) line endings, but the portions of the file that was changed in Visual Studio has Windows style (CR/LF
) line endings.
In Visual Studio, I've already manually saved the files as "Unix Line Ending" via the "Advanced Save Options" dialog, but this setting doesn't appear to persist after SVN commits, which leads me to suspect that no actual file options are saved in the Visual Studio project file (.vcproj
) or solution file (.sln
), but the encoding of the source file itself is just changed, and isn't preserved on our SVN server.
How can I just set-and-forget line endings for cross-platform projects like this, or get Visual Studio to stop messing up the files? It was to my understanding that setting the EOL-style to native meant that clients check out files in the system's native encoding, and it's stored in a "preferred" format on the SVN server, so I wouldn't have to deal with these issue.
Thank you.