Eclipse和Windows换行符 [英] Eclipse and Windows newlines
问题描述
我可以做一个脚本,但是我想知道是否会搞砸我的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.
解决方案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屋!