From 6812cbbe2bc5ea80f5783703ef25a99eab6f019e Mon Sep 17 00:00:00 2001 From: Ranjeet Kumar Ranjan Date: Wed, 13 Jul 2022 15:05:33 +0530 Subject: [PATCH] Add RealPath module --- src/Streamly/Coreutils/RealPath.hs | 21 +++++++++++++++++++++ streamly-coreutils.cabal | 1 + 2 files changed, 22 insertions(+) create mode 100644 src/Streamly/Coreutils/RealPath.hs diff --git a/src/Streamly/Coreutils/RealPath.hs b/src/Streamly/Coreutils/RealPath.hs new file mode 100644 index 0000000..96da01f --- /dev/null +++ b/src/Streamly/Coreutils/RealPath.hs @@ -0,0 +1,21 @@ +-- | +-- Module : Streamly.Coreutils.RealPath +-- Copyright : (c) 2022 Composewell Technologies +-- License : BSD-3-Clause +-- Maintainer : streamly@composewell.com +-- Stability : experimental +-- Portability : GHC +-- +-- Returns resolved symbolic link target. + +module Streamly.Coreutils.RealPath + (realPath) +where + +import System.Directory (canonicalizePath ) + +-- | Make a path absolute, normalize the path, +-- and remove as many indirections from it as possible. + +realPath :: FilePath -> IO FilePath +realPath = canonicalizePath diff --git a/streamly-coreutils.cabal b/streamly-coreutils.cabal index 934bc75..4906ac6 100644 --- a/streamly-coreutils.cabal +++ b/streamly-coreutils.cabal @@ -118,6 +118,7 @@ library , Streamly.Coreutils.FileTest , Streamly.Coreutils.Ls , Streamly.Coreutils.String + , Streamly.Coreutils.RealPath , Streamly.Coreutils.ShellWords , Streamly.Coreutils.Sleep , Streamly.Coreutils.Uniq