Not too long ago, I ventured into using Rake for my .Net project builds. Given that my shell preference on Windows is Cygwin’s bash port (via the excellent mintty terminal), I tend to prefer installing the Cygwin ruby package rather than using the RubyInstaller for Windows.
One issue I ran into, however, was that the absolute paths generated under rake resolve to /cygdrive/c/ by default. This isn’t an issue when calling applications compiled for Cygwin, but they pose a problem if you need to pass an absolute path as a parameter to commands like MSBuild. One way to resolve this problem is to create an NTFS mount point which mirrors a path that Windows executables can resolve. Here’s how:
Open up the file /etc/fstab which configures the mount table under Cygwin. Add a line similar to the following:
C:/projects /projects ntfs binary,posix=0,user 0 0
This mounts the C:/projects folder (where I do all of my project development) as /projects. Note that the mount point must be named the same as the actual physical NTFS path. After restarting the shell, the new mount point will be available. This can be verified by issuing the mount command:
> mount C:/cygwin/bin on /usr/bin type ntfs (binary,auto) C:/cygwin/lib on /usr/lib type ntfs (binary,auto) C:/projects on /projects type ntfs (binary,posix=0,user) C:/cygwin on / type ntfs (binary,auto) C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) D: on /cygdrive/d type iso9660 (binary,posix=0,user,noumount,auto) F: on /cygdrive/f type iso9660 (binary,posix=0,user,noumount,auto) G: on /cygdrive/g type ntfs (binary,posix=0,user,noumount,auto) H: on /cygdrive/h type ntfs (binary,posix=0,user,noumount,auto) I: on /cygdrive/i type vfat (binary,posix=0,user,noumount,auto)
Since Windows accepts the forward slash as a directory delimiter and considers drive letters to be optional, expanding a relative path under the NTFS mount point will render a path that can be correctly interpreted by Windows executables.