{-# LINE 1 "System\\Win32\\WindowsString\\Path.hsc" #-}
module System.Win32.WindowsString.Path (
filepathRelativePathTo
, pathRelativePathTo
) where
import System.Win32.Path.Internal
import System.Win32.WindowsString.Types
import System.Win32.WindowsString.File
import System.OsPath.Windows
import Foreign
#include "windows_cconv.h"
filepathRelativePathTo :: WindowsPath -> WindowsPath -> IO WindowsPath
filepathRelativePathTo from to =
withTString from $ \p_from ->
withTString to $ \p_to ->
allocaArray ((260) * ((1))) $ \p_AbsPath -> do
{-# LINE 36 "System\\Win32\\WindowsString\\Path.hsc" #-}
_ <- failIfZero "PathRelativePathTo" (c_pathRelativePathTo p_AbsPath p_from fILE_ATTRIBUTE_DIRECTORY
p_to fILE_ATTRIBUTE_NORMAL)
path <- peekTString p_AbsPath
_ <- localFree p_AbsPath
return path
pathRelativePathTo :: WindowsPath -> FileAttributeOrFlag -> WindowsPath -> FileAttributeOrFlag -> IO WindowsPath
pathRelativePathTo from from_attr to to_attr =
withTString from $ \p_from ->
withTString to $ \p_to ->
allocaArray ((260) * ((1))) $ \p_AbsPath -> do
{-# LINE 47 "System\\Win32\\WindowsString\\Path.hsc" #-}
_ <- failIfZero "PathRelativePathTo" (c_pathRelativePathTo p_AbsPath p_from from_attr
p_to to_attr)
path <- peekTString p_AbsPath
_ <- localFree p_AbsPath
return path