fssm
fssm copied to clipboard
Bugfix for FSSM::Tree::Cache on UNC.
Maybe, this problem occurs only under the cygwin environment.
Cause of a problem:
Pathname("//host/share").join("hoge.txt")
# => #<Pathname://host/sharehoge.txt>
Pathname("//host/share/").join("hoge.txt")
# => #<Pathname://host/share/hoge.txt>
This makes corruption at FSSM::Pathname.for().join() in FSSM::Tree::NodeEnumerable.each(). Therefore FSSM::Tree::Cache.files is not work correctly on UNC. This patch modifies the behavior as below.
before:
FSSM::Pathname.for("//host/share/hoge.txt").segments
# => ["//host/share", "hoge.txt"]
cache = FSSM::Tree::Cache.new
# => #<FSSM::Tree::Cache:0x00000600440b28 @children={}>
cache.set "//host/share/hoge.txt"
# => 2014-02-25 11:38:19 +0900
cache.files
# => {"//host/sharehoge.txt"=>2014-02-25 11:38:19 +0900}
after:
FSSM::Pathname.for("//host/share/hoge.txt").segments
# => ["//host/share/", "hoge.txt"]
cache = FSSM::Tree::Cache.new
# => #<FSSM::Tree::Cache:0x0000060003e660 @children={}>
cache.set "//host/share/hoge.txt"
# => 2014-02-25 11:38:19 +0900
cache.files
# => {"//host/share/hoge.txt"=>2014-02-25 11:38:19 +0900}