Eclipse和Windows换行符 [英] Eclipse and Windows newlines

查看:140
本文介绍了Eclipse和Windows换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的桌面崩溃时,我不得不将我的Eclipse工作区从Linux移动到Windows。一周之后,我将其复制回Linux,代码愉快地承诺CVS。唉,Windows的换行符已经污染了很多文件,所以CVS会将整个文件转换成整个文件,即使我改了一两行!



我可以做一个脚本,但是我想知道是否会搞砸我的Eclipse项目文件。

解决方案

如上所述这里这里


将文件编码设置为 UTF-8 和行结尾对于新的文件到Unix,以便文本文件以不是特定于Windows操作系统的格式保存,最容易在异构开发人员桌面上共享:




  • 导航到工作区首选项(常规:工作区)

  • 将文本文件编码更改为 UTF-8

  • 将新文本文件行分隔符更改为其他,并从选择列表中选择Unix




  • 注意:转换行尾一个现有文件,在Eclipse中打开该文件并选择文件:将行分隔符转换为:Unix


< blockquote>

提示:您可以通过在包资源管理器中选择然后进入菜单条目文件轻松转换现有文件:将行分隔符转换为:Unix


I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlines have polluted many files, so CVS diff dumps the entire file, even when I changed a line or two!

I could cook up a script, but I am wondering if it will mess up my Eclipse project files. Comments please.

解决方案

As mentioned here and here:

Set file encoding to UTF-8 and line-endings for new files to Unix, so that text files are saved in a format that is not specific to the Windows OS and most easily shared across heterogeneous developer desktops:

  • Navigate to the Workspace preferences (General:Workspace)
  • Change the Text File Encoding to UTF-8
  • Change the New Text File Line Delimiter to Other and choose Unix from the pick-list

  • Note: to convert the line endings of an existing file, open the file in Eclipse and choose File : Convert Line Delimiters to : Unix

Tip: You can easily convert existing file by selecting then in the Package Explorer, and then going to the menu entry File : Convert Line Delimiters to : Unix

这篇关于Eclipse和Windows换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆