svn 返回“无效的控制字符‘0x0d’”在路径“图标\015”中尝试添加 Mac 自定义图标文件时
我有一个创建磁盘映像的项目,并希望为加载的卷使用自定义图标。我有一个 .VolumeIcon.icns
文件,看起来很棒,但为了让 Finder 使用它,我必须包含一个名为 Icon^M
的空文件(Icon\r ,图标
除了。当我尝试将 Icon^M 文件签入我的 svn 存储库时,我得到:
svn: Invalid control character '0x0d' in path 'Icon\015'
Subversion 的文件名标准比 Mac 更严格,并且不允许回车。 svn 邮件列表上的一个旧线程讨论了这个问题,建议只使用 shell 脚本创建文件作为构建过程的一部分。我可以做到这一点,但我的构建过程现在非常简单,我不愿意让它变得更复杂。
有更优雅的解决方案吗?
I have a project that creates a disk image and would like to use a custom icon for the loaded volume. I have a .VolumeIcon.icns
file that looks great, but to make Finder use it, I've had to include an empty file named Icon^M
(Icon\r, Icon<cr>). My custom icon shows up and everything works great.
Except. When I try to check the Icon^M file into my svn repository I get:
svn: Invalid control character '0x0d' in path 'Icon\015'
Subversion has stricter filename standards than Mac and, reasonably, doesn't allow carriage returns. An old thread on the svn mailing list discussed this problem, and the recommendation was to just create the file with a shell script as part of the build process. I could do that, but my build process is very simple right now and I'm loath to make it more complex.
Is there a more elegant solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这个图标问题困扰了我一段时间。基本的解决方案基本上是完全忽略该文件,我拒绝这样做,因为我是一个视觉人士,喜欢浪费时间为我的项目创建很酷的图标。
注意:我已尽力确保其有效,但我不能保证它,因此请尝试使用您的数据副本。话虽如此,这就是我对这个问题的解决方案。
基本上我创建了 3 个脚本来解决 mac 图标问题。
这三个脚本用于以 git 或 svn 可以接受和存储的格式添加 mac 图标。第一个脚本准备存储库,搜索目录中基于图标的文件以及文件中的自定义图标格式。然后将它们存储为 .jdIcnd 或 .jdIcnf (d 代表目录 f 代表文件夹)在各自的路径中。
第二个脚本允许它通过搜索 .jdIcnd 和 .jdIcnf 文件在 Mac 上恢复活力。
最后一个脚本展示了如何自动化该过程。我使用 git 的别名来引用 .bashrc 文件中的 gitAliasScript.sh 脚本。现在我切换到 git (我做的最好的事情),因此显示了 git 的脚本,但 svn 中的基础知识是相同的。我希望这可以帮助使用版本控制系统的 Mac 用户,他们不会在签入过程或签出过程中丢失图标。另请注意,那些不使用此脚本的人不会遇到问题,因为图标存储为带有点前缀的二进制文件,使它们不可见。哦是的...
文件:repoMacPrepare.sh
文件:repoMacRestore.sh
gitAliasScript.sh
This problem with icons has bothered me for some time. The basic solution was basically to ignore the file completely, which I refused to do as I am a visual person and enjoy wasting my time creating cool icons for my projects.
Note: I did my best to make sure it works, but I can't guarantee it, so try on a copy of your data. With that said here was my solution to this issue.
Basically I created 3 scripts to address the mac icon\r issue.
These three scripts are used to add mac Icons in a format that git or svn can accept and store. The first script prepares the repository searching for Icon based files in directories and custom icon formats within files. Then stores them as either .jdIcnd or .jdIcnf (d for directory f for folder) within their respective paths.
The second script allows it to be brought back to life on the mac by searching for .jdIcnd and .jdIcnf files.
The last script shows how to automate the process. I use an alias for git that references the gitAliasScript.sh script in my .bashrc file. Now I switched to git (best thing I did) so the script is shown for git but the basics are the same in svn. I hope this helps mac users using versioning systems who don't won't to lose their icons as part of a checkin process or checkout process. Also note that those not using this script won't have issues since the icons are stored as binary files with a dot prefix making them invisible. Oooh yeah...
file: repoMacPrepare.sh
file: repoMacRestore.sh
gitAliasScript.sh
我觉得你骨头都秃了你现在用什么来构建?我向任何能够提出比您自己提出的答案更好的答案的人致敬 - 在构建中编写脚本。
I think you're boned. What are you using to build now? I'll tip my hat to anyone that can come up with a better answer than the one you yourself proposed - scripting it in the build.
我猜想将文件放入诸如 tar 之类的存档中将允许您上传它。
让我看看它是否真的有效......看起来我是对的:
也许不是你正在寻找的,但让你几乎不费力地添加文件。无论如何我都会这样做。实际上我不会在我的文件名中添加换行符或回车符,但是嘿..每个人都有自己的。
I'm guessing putting the file in an archive such as tar would allow you to upload it.
Let me see if it actually works... looks like I'm right:
Perhaps not what you're looking, but lets you add the file with almost no hustle. I would do it like that anyway. Actually I wouldn't put newlines or carriage returns in my file names, but hey.. to each his own.
这种情况发生在我身上,因为在我将图标文件重命名为 Icon.png 后,存在没有扩展名的图标文件(在本例中为 .png),一切都正常:)
This happens to me because there was icon file without extension (in this case .png) after I renamed the icon file to Icon.png it was all okay :)
复制 ~/.subversion/config
然后编辑 ~/.subversion/config ,首先找到如下所示的行:
然后添加 a配置中的新行:
保存配置文件。这将忽略名称以“Icon”加一个附加字符开头的所有文件。
不如忽略完全忽略该文件的名称。但它的工作原理需要注意。
Make a copy of ~/.subversion/config
Then edit ~/.subversion/config by first finding the line which looks like:
Then add after that a new line in config:
Save the config file. This will ignore all files whose name starts with "Icon" plus one additional character.
Not as good as ignore ignoring exactly what that file is named. But it works with caveat.