Permalink
Browse files

Moved 'canonicalizePath' usge to be more localized.

We only really need to have the canonical path for comparison
purposes in one place, and I've heard that it caused a bug for
someone when it was always canonicalized.
  • Loading branch information...
1 parent ffc9adb commit c78013a86942bfe74d5d86379c3eaae6cd839c67 @willdonnelly committed Aug 16, 2010
Showing with 13 additions and 8 deletions.
  1. +9 −2 Config/Dyre.hs
  2. +1 −3 Config/Dyre/Paths.hs
  3. +3 −3 dyre.cabal
View
11 Config/Dyre.hs
@@ -96,7 +96,7 @@ when run.
module Config.Dyre ( wrapMain, Params(..), defaultParams ) where
import System.IO ( hPutStrLn, stderr )
-import System.Directory ( doesFileExist, removeFile )
+import System.Directory ( doesFileExist, removeFile, canonicalizePath )
import System.Environment ( getArgs )
import Control.Monad ( when )
@@ -162,7 +162,14 @@ wrapMain params@Params{projectName = pName} cfg = withDyreOptions params $
-- gone.
errorData <- getErrorString params
customExists <- doesFileExist tempBinary
- if confExists && customExists && (thisBinary /= tempBinary)
+
+ -- Canonicalize the paths for comparison to avoid symlinks throwing
+ -- us off. We do it here instead of earlier because canonicalizePath
+ -- drops path components when one of them is nonexistent.
+ thisBinary' <- canonicalizePath thisBinary
+ tempBinary' <- canonicalizePath tempBinary
+
+ if confExists && customExists && (thisBinary' /= tempBinary')
then launchSub errorData tempBinary
else enterMain errorData
where launchSub errorData tempBinary = do
View
4 Config/Dyre/Paths.hs
@@ -28,9 +28,7 @@ getPaths params@Params{projectName = pName} = do
let tempBinary = cacheDir </> pName ++ "-" ++ os ++ "-" ++ arch
let configFile = configDir </> pName ++ ".hs"
- thisBinary' <- canonicalizePath thisBinary
- tempBinary' <- canonicalizePath tempBinary
- return (thisBinary', tempBinary', configFile, cacheDir)
+ return (thisBinary, tempBinary, configFile, cacheDir)
-- | Check if a file exists. If it exists, return Just the modification
-- time. If it doesn't exist, return Nothing.
View
6 dyre.cabal
@@ -1,5 +1,5 @@
name: dyre
-version: 0.8.4
+version: 0.8.5
category: Development, Configuration
synopsis: Dynamic reconfiguration in Haskell
@@ -13,10 +13,10 @@ description: Dyre implements dynamic reconfiguration facilities after the
homepage: http://github.com/willdonnelly/dyre
bug-reports: http://github.com/willdonnelly/dyre/issues
-stability: alpha
+stability: beta
author: Will Donnelly
maintainer: Will Donnelly <will.donnelly@gmail.com>
-copyright: (c) 2009 Will Donnelly
+copyright: (c) 2010 Will Donnelly
license: BSD3
license-file: LICENSE

0 comments on commit c78013a

Please sign in to comment.