Author Topic: LF and CRLF in C::B files  (Read 9699 times)

AdiShavit

  • Guest
LF and CRLF in C::B files
« on: July 29, 2010, 02:45:24 pm »
Hi,

  Is there a way to get C::B to save its config files (.workspace, .layout, .cbp) using CRLF for line breaks and not LF?

Thanks,
Adi

Offline Teybeo

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: LF and CRLF in C::B files
« Reply #1 on: July 02, 2012, 04:17:27 pm »
This topic is near exactly 2 years old but I would like to have this feature too.
Git always complains that the .cbp file is LF ending and that it will have to convert it internally to CR-LF (along with the .layout and .workspace but I don't track them).
I think I could do something with the "auto-crlf" configuration in Git but changing the Codeblocks way of encoding its projects files seems easy... maybe it isn't ?

Using 8024 on Win7 64bits
« Last Edit: July 03, 2012, 11:25:52 am by Teybeo »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: LF and CRLF in C::B files
« Reply #2 on: July 02, 2012, 04:31:30 pm »
This topic is near exactly 2 years old but I would like to have this feature too.
Git always complains that the .cbp file is LF ending and that it will have to convert it internally to CR-LF (along with the .layout and .workspace but I don't track them).
I think I could do something with the "auto-crlf" configuration in Git but changing the Codeblocks way of encoding its projects files seems easy... maybe it isn't ?

Using 8059 on Win7 64bits

Fix your GIT Settings; I have never used GIT; but, Google gives directions.

https://help.github.com/articles/dealing-with-line-endings

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Teybeo

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: LF and CRLF in C::B files
« Reply #3 on: July 03, 2012, 12:01:08 pm »
That's what I did but really I don't understand what's happening. It's said that Git use LF internally so why would it have to do any conversion to a LF file ?
My autocrlf option is set to "true", which means "that Git will process all text files and make sure that CRLF is replaced with LF when writing that file to the object database and turn all LF back into CRLF when writing out into the working directory. This is the recommended setting on Windows because it ensures that your repository can be used on other platforms while retaining CRLF in your working directory."

Anyway I just added "*.cbp eol=lf" in the global .gitattributes file and the warning doesn't appears anymore.

In the end, is there a good reason for Codeblocks to have only LF in the projects files ? It could avoid having to deal with these stupids LF/CRLF problems at least on Windows

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: LF and CRLF in C::B files
« Reply #4 on: July 29, 2013, 11:24:03 am »
FYI:
The reason is here: Re: Issue about saving the cbp project file, I think it should be fixed. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.