fssm
fssm copied to clipboard
Incorrect path segments for cygwin path
For cygwin paths, following code produces incorrect array of path segments:
require 'rubygems'
require 'fssm'
print "#{FSSM::Pathname.for('/cygdrive/c/tmp').segments.join(', ')}\n"
//, cygdrive, c, tmp
This is due to line 26 of pathname.rb:
array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT
This is related to https://github.com/ttilley/fssm/commit/a394304b66008872f7fcacfffcd2cdad0e6a2f9e#commitcomment-357393 . The solution there points out that adding unless path[0, 1] == File::SEPARATOR
to line 26 fixes it.
array[0] += File::SEPARATOR if path[0, 3] =~ SEPARATOR_PAT unless path[0, 1] == File::SEPARATOR
Should someone (me?) create a pull request for this, or is it not cross platform safe? I really hate modifying gem files directly, so getting this fixed would be really nice.