On Fri, Sep 21, 2012 at 10:48 AM, Michael Hanselmann <[email protected]> wrote: > unsafePerformIO is required to go from the IO monad to pure code. > > Signed-off-by: Michael Hanselmann <[email protected]> > --- > htools/Ganeti/Path.hs | 26 ++++++++++++++------------ > 1 files changed, 14 insertions(+), 12 deletions(-) > > diff --git a/htools/Ganeti/Path.hs b/htools/Ganeti/Path.hs > index 5f439dd..2446f52 100644 > --- a/htools/Ganeti/Path.hs > +++ b/htools/Ganeti/Path.hs > @@ -23,31 +23,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, > Boston, MA > > -} > > -module Ganeti.Path > - ( defaultLuxiSocket > - , defaultQuerySocket > - , dataDir > - , logDir > - , runDir > - , confdHmacKey > - , clusterConfFile > - ) where > +module Ganeti.Path where > > import qualified Ganeti.Constants as C > import System.FilePath > +import System.Posix.Env (getEnv) > +import System.IO.Unsafe > > > +-- | Prefixes a path with the current root directory > +addNodePrefix :: FilePath -> FilePath > +addNodePrefix path = do > + let val = unsafePerformIO $ getEnv "GANETI_ROOTDIR"
Put the unsafePerformIO down on the floor, slowly, and back away from the console... René
