diff options
author | 2014-12-30 15:04:36 -0400 | |
---|---|---|
committer | 2014-12-30 15:05:59 -0400 | |
commit | aa74dc1ce0810c0c9e6cd6714409b98140e830c5 (patch) | |
tree | 5f2648ee261acc23fbf3c3c009253ec279f09362 /Utility/Rsync.hs | |
parent | 595c6c38bfb847dbaf689ecb4e5c17535d43d890 (diff) |
Windows: Got the rsync special remote working.
More aggressive rsync params fixup for windows. Param may contain a url, or
a file path, so check if it looks like a local file path and if so, fix it
up.
On windows only, rsyncUrlIsPath will treat c:foo as a path, rather than as
a rsyncurl starting with a host "c".
Diffstat (limited to 'Utility/Rsync.hs')
-rw-r--r-- | Utility/Rsync.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Utility/Rsync.hs b/Utility/Rsync.hs index b314df14e..ed1eab6f3 100644 --- a/Utility/Rsync.hs +++ b/Utility/Rsync.hs @@ -5,6 +5,8 @@ - License: BSD-2-clause -} +{-# LANGUAGE CPP #-} + module Utility.Rsync where import Common @@ -53,12 +55,18 @@ rsync = boolSystem "rsync" . rsyncParamsFixup {- On Windows, rsync is from Cygwin, and expects to get Cygwin formatted - paths to files. (It thinks that C:foo refers to a host named "C"). - - Fix up all Files in the Params appropriately. -} + - Fix up the Params appropriately. -} rsyncParamsFixup :: [CommandParam] -> [CommandParam] +#ifdef mingw32_HOST_OS rsyncParamsFixup = map fixup where fixup (File f) = File (toCygPath f) + fixup (Param s) + | rsyncUrlIsPath s = Param (toCygPath s) fixup p = p +#else +rsyncParamsFixup = id +#endif {- Checks if an rsync url involves the remote shell (ssh or rsh). - Use of such urls with rsync requires additional shell @@ -78,6 +86,9 @@ rsyncUrlIsShell s {- Checks if a rsync url is really just a local path. -} rsyncUrlIsPath :: String -> Bool rsyncUrlIsPath s +#ifdef mingw32_HOST_OS + | not (null (takeDrive s)) = True +#endif | rsyncUrlIsShell s = False | otherwise = ':' `notElem` s |