haskell-hvr / missingh

Utility library [Haskell]
https://hackage.haskell.org/package/MissingH
Other
87 stars 40 forks source link

Windows file system compatibility (for HVFS) #25

Closed bjornbm closed 10 years ago

bjornbm commented 10 years ago

I've replaced all forward slashes in file paths with 'pathSeparator', 'isPathSeparator', and '</>' from System.FilePath. This allows using HVFS and HVFSChroot on Windows (and by extension serving directories with hsftp).

I have used the functions from filePath where it seemed appropriate, but not where MissingH behaves notably (by tests) differently: e.g. splice_path/unsplice_path versus splitPath/joinPath.

I replaced ++ "/" ++ with </>. This isn't exactly equivalent as </> will handle drop the first argument if the second is an absolute path. This doesn't break any of the tests, but if you think it will be a problem ++ [pathSeparator] ++ can be used instead.

Since the change precludes pattern matching on '/' I had to restructure some of the functions to use if … then …else instead of case … of.

I have not made these replacements in System.Daemon, which I'm not sure is relevant to Windows (uses '/dev/null').

The tests have been updated so they pass on Windows (with the exception of 4:Time:0:ctu2e:0 and 4:Time:0:ctu2e:0 which are already broken and unaffected by this change).