fssm icon indicating copy to clipboard operation
fssm copied to clipboard

Incorrect path segments for cygwin path

Open sankl opened this issue 13 years ago • 1 comments

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

sankl avatar Aug 08 '11 18:08 sankl

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.

pho3nixf1re avatar Oct 20 '11 18:10 pho3nixf1re