Configuring the line ending character for .usda serialization

Hello,

As I understand, currently the SdfTextFileFormat always serializes the layers with ‘\n’ Unix style line endings. We have an issue where our source control system is configured to fix the line endings to match the operating system of the user, which in our case is almost always Windows. This causes some hashing issues for us, and we were wondering if it is possible to configure USD to use a specific line ending character when serializing the layers.

We do have our own file format based on SdfTextFileFormat, so I guess we could fix the endings there before writing to disk, but if there’s a better solution I’d be happy to hear about it.

Thanks in advance,
Jouni

My vote would be to avoid increasing variability in the spec, by allowing official support for windows-style line endings.

This feels like more an issue with the VCS than with USD. I know you can configure git to apply different rules for different file types - you could explicitly tell it to not translate . usda and .usd files. If you’re using a different vcs tool, hopefully it has similar configurability.

Personally, I hate all the “automatic line conversion” stuff - I feel like the “solution” ends up just creating more headaches (like your file-hash-changing scenario) than the original issue. I can’t remember the last time I used a tool on Windows that wasn’t able to deal with /n line endings…

Agreed with @pmolodo , here. Initially perforce was trying to do this to our usda files also, but we reconfigured it to not do so. My understanding is that most applications on all platforms are “OK” with either form of line-ending (including msvc), and allowing the UsdaFileFormat to be configurable moves the hashing/diffing problem from your site to the entire world.