Skip to content

Commit

Permalink
Make sure the initial project is writable (jaspervdj#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasBora authored Nov 11, 2020
1 parent 17b4c81 commit 6ea0b9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Data.Char (isAlphaNum, isNumber)
import Data.List (foldl', intercalate, isPrefixOf)
import Data.Version (Version (..))
import System.Directory (canonicalizePath, copyFile,
doesFileExist)
doesFileExist,
setPermissions, getPermissions, writable)
import System.Environment (getArgs, getProgName)
import System.Exit (exitFailure)
import System.FilePath (splitDirectories, (</>))
Expand Down Expand Up @@ -65,6 +66,10 @@ main = do
putStrLn $ "Creating " ++ dst
makeDirectories dst
copyFile src dst
-- On some systems, the source folder may be readonly,
-- and copyFile will therefore create a readonly project...
p <- getPermissions dst
setPermissions dst (p {writable = True})

putStrLn $ "Creating " ++ cabalPath
createCabal cabalPath name
Expand Down

0 comments on commit 6ea0b9b

Please sign in to comment.