File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed
cabal-install/src/Distribution/Client Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -731,17 +731,19 @@ initialSavedConfig = do
731
731
warnOnTwoConfigs :: Verbosity -> IO ()
732
732
warnOnTwoConfigs verbosity = do
733
733
defaultDir <- getAppUserDataDirectory " cabal"
734
- dotCabalExists <- doesDirectoryExist defaultDir
735
- xdgCfg <- getXdgDirectory XdgConfig (" cabal" </> " config" )
736
- xdgCfgExists <- doesFileExist xdgCfg
737
- when (dotCabalExists && xdgCfgExists) $
738
- warn verbosity $
739
- " Both "
740
- <> defaultDir
741
- <> " and "
742
- <> xdgCfg
743
- <> " exist - ignoring the former.\n "
744
- <> " It is advisable to remove one of them. In that case, we will use the remaining one by default (unless '$CABAL_DIR' is explicitly set)."
734
+ xdgCfgDir <- getXdgDirectory XdgConfig " cabal"
735
+ when (defaultDir /= xdgCfgDir) $ do
736
+ dotCabalExists <- doesDirectoryExist defaultDir
737
+ let xdgCfg = xdgCfgDir </> " config"
738
+ xdgCfgExists <- doesFileExist xdgCfg
739
+ when (dotCabalExists && xdgCfgExists) $
740
+ warn verbosity $
741
+ " Both "
742
+ <> defaultDir
743
+ <> " and "
744
+ <> xdgCfg
745
+ <> " exist - ignoring the former.\n "
746
+ <> " It is advisable to remove one of them. In that case, we will use the remaining one by default (unless '$CABAL_DIR' is explicitly set)."
745
747
746
748
-- | If @CABAL\_DIR@ is set, return @Just@ its value. Otherwise, if
747
749
-- @~/.cabal@ exists and @$XDG_CONFIG_HOME/cabal/config@ does not
You can’t perform that action at this time.
0 commit comments