{-# LANGUAGE CPP #-}
module System.Win32.WindowsString.HardLink
( createHardLink
, createHardLink'
) where
import System.Win32.HardLink.Internal
import System.Win32.WindowsString.File ( failIfFalseWithRetry_ )
import System.Win32.WindowsString.String ( withTString )
import System.Win32.WindowsString.Types ( nullPtr )
import System.OsPath.Windows
#include "windows_cconv.h"
createHardLink :: WindowsPath
-> WindowsPath
-> IO ()
createHardLink = flip createHardLink'
createHardLink' :: WindowsPath
-> WindowsPath
-> IO ()
createHardLink' link target =
withTString target $ \c_target ->
withTString link $ \c_link ->
failIfFalseWithRetry_ (unwords ["CreateHardLinkW",show link,show target]) $
c_CreateHardLink c_link c_target nullPtr