{-# LINE 1 "System\\Win32\\SymbolicLink.hsc" #-}
{-# LANGUAGE CPP #-}
{-# LINE 2 "System\\Win32\\SymbolicLink.hsc" #-}
module System.Win32.SymbolicLink
( module System.Win32.SymbolicLink
) where
import System.Win32.Types
import System.Win32.File ( failIfFalseWithRetry_ )
#include "windows_cconv.h"
type SymbolicLinkFlags = DWORD
sYMBOLIC_LINK_FLAG_FILE :: SymbolicLinkFlags
sYMBOLIC_LINK_FLAG_FILE = 0
sYMBOLIC_LINK_FLAG_DIRECTORY :: SymbolicLinkFlags
sYMBOLIC_LINK_FLAG_DIRECTORY = 1
{-# LINE 35 "System\\Win32\\SymbolicLink.hsc" #-}
createSymbolicLink :: FilePath
-> FilePath
-> SymbolicLinkFlags -> IO ()
createSymbolicLink = flip createSymbolicLink'
createSymbolicLinkFile :: FilePath -> FilePath -> IO ()
createSymbolicLinkFile target link = createSymbolicLink' link target sYMBOLIC_LINK_FLAG_FILE
createSymbolicLinkDirectory :: FilePath -> FilePath -> IO ()
createSymbolicLinkDirectory target link = createSymbolicLink' link target sYMBOLIC_LINK_FLAG_DIRECTORY
createSymbolicLink' :: FilePath
-> FilePath
-> SymbolicLinkFlags -> IO ()
createSymbolicLink' link target flag = do
withTString link $ \c_link ->
withTString target $ \c_target ->
failIfFalseWithRetry_ (unwords ["CreateSymbolicLink",show link,show target]) $
c_CreateSymbolicLink c_link c_target flag
foreign import WINDOWS_CCONV unsafe "windows.h CreateSymbolicLinkW"
c_CreateSymbolicLink :: LPTSTR -> LPTSTR -> SymbolicLinkFlags -> IO BOOL