How to shell script a list of files with their modification time on mingw?

后端 未结 3 543
梦毁少年i
梦毁少年i 2020-12-22 04:52

Disclaimer: This question exists because of Unity3D and its library issue.

I\'ve tried getting current git-cache-meta.sh and use it on windows. It doesn\'t work.

3条回答
  •  轮回少年
    2020-12-22 05:34

    MinGW likes to call native Windows tools which add a Carriage Return (CR, \r) to the end of each line. So you can replace $(commandname) with $(commandname | sed $'s/\r$//') or something similar.

    Another option is to try something more Unix-y, such as Interix/SFU/SUA or Cygwin or MSYS or AT&T UWIN.

    As for metadata in general, your problem will be that things like chown, chgrp, chmod and touch will behave differently on the Windows® platform, and some things will not even exist, especially on FAT filesystems, whereas NTFS has a completely different set of metadata (different format for time stamps, ACLs instead of Unix user/group/other permissions, etc.) so it’s likely to require some development work from someone who understands the Unix scripting world and the NT platform well.

    Finally, I’d like to say that this script is a security hole since it just evaluates stored commands, so if anyone else has got the ability to write to the .git_cache_meta file, they will own your system.

提交回复
热议问题