more OsPath conversion
Sponsored-by: Leon Schuermann
This commit is contained in:
parent
ee0964e61b
commit
f3539efc16
18 changed files with 156 additions and 153 deletions
|
@ -134,16 +134,16 @@ modifyUserSshConfig modifier = changeUserSshConfig $
|
|||
changeUserSshConfig :: (String -> String) -> IO ()
|
||||
changeUserSshConfig modifier = do
|
||||
sshdir <- sshDir
|
||||
let configfile = sshdir </> "config"
|
||||
let configfile = sshdir </> literalOsPath "config"
|
||||
whenM (doesFileExist configfile) $ do
|
||||
c <- decodeBS . S8.unlines . fileLines'
|
||||
<$> F.readFile' (toOsPath (toRawFilePath configfile))
|
||||
<$> F.readFile' configfile
|
||||
let c' = modifier c
|
||||
when (c /= c') $ do
|
||||
-- If it's a symlink, replace the file it
|
||||
-- points to.
|
||||
f <- catchDefaultIO configfile (canonicalizePath configfile)
|
||||
viaTmp writeSshConfig (toOsPath (toRawFilePath f)) c'
|
||||
viaTmp writeSshConfig f c'
|
||||
|
||||
writeSshConfig :: OsPath -> String -> IO ()
|
||||
writeSshConfig f s = do
|
||||
|
@ -161,7 +161,7 @@ setSshConfigMode :: RawFilePath -> IO ()
|
|||
setSshConfigMode f = void $ tryIO $ modifyFileMode f $
|
||||
removeModes [groupWriteMode, otherWriteMode]
|
||||
|
||||
sshDir :: IO FilePath
|
||||
sshDir :: IO OsPath
|
||||
sshDir = do
|
||||
home <- myHomeDir
|
||||
return $ home </> ".ssh"
|
||||
return $ toOsPath home </> literalOsPath ".ssh"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue