Skip to content

Commit

Permalink
Add if statement in getAppDir for Library type
Browse files Browse the repository at this point in the history
Added a statement in getAppDir function for if the package type
is Library, then return Just [] to appDirs else perform normal
return function.

Removed noAppDirIfLibrary function as the new if statement
handles the Library type.

Resolves: haskell#6772
  • Loading branch information
Jeremy Scott committed Oct 8, 2020
1 parent 3f397c0 commit edcc0a9
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cabal-install/src/Distribution/Client/Init/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -468,20 +468,16 @@ getGenComments flags = do
getAppDir :: InitFlags -> IO InitFlags
getAppDir flags = do
appDirs <-
return (applicationDirs flags)
?>> noAppDirIfLibraryOnly
?>> guessAppDir flags
?>> promptUserForApplicationDir
?>> setDefault
if (packageType flags) == Flag Library
then return (Just [])
else return (applicationDirs flags)
?>> guessAppDir flags
?>> promptUserForApplicationDir
?>> setDefault

return $ flags { applicationDirs = appDirs }

where
-- If the packageType==Library, then there is no application dir.
noAppDirIfLibraryOnly :: IO (Maybe [String])
noAppDirIfLibraryOnly =
if (packageType flags) == Flag Library
then return (Just [])
else return Nothing

-- Set the default application directory.
setDefault :: IO (Maybe [String])
Expand Down

0 comments on commit edcc0a9

Please sign in to comment.