@@ -21,14 +21,14 @@ module Foreign.Lua.Module.System (
2121 , os
2222
2323 -- * Functions
24- , chdir
2524 , env
2625 , getwd
2726 , getenv
2827 , ls
2928 , mkdir
3029 , rmdir
3130 , setenv
31+ , setwd
3232 , tmpdirname
3333 , with_env
3434 , with_tmpdir
@@ -63,14 +63,14 @@ pushModule = do
6363 addField " compiler_name" compiler_name
6464 addField " compiler_version" compiler_version
6565 addField " os" os
66- addFunction " chdir" chdir
6766 addFunction " env" env
6867 addFunction " getenv" getenv
6968 addFunction " getwd" getwd
7069 addFunction " ls" ls
7170 addFunction " mkdir" mkdir
7271 addFunction " rmdir" rmdir
7372 addFunction " setenv" setenv
73+ addFunction " setwd" setwd
7474 addFunction " tmpdirname" tmpdirname
7575 addFunction " with_env" with_env
7676 addFunction " with_tmpdir" with_tmpdir
@@ -110,10 +110,6 @@ os = Info.os
110110-- Functions
111111--
112112
113- -- | Change current working directory.
114- chdir :: FilePath -> Lua ()
115- chdir fp = ioToLua $ Directory. setCurrentDirectory fp
116-
117113-- | Retrieve the entire environment
118114env :: Lua NumResults
119115env = do
@@ -160,6 +156,10 @@ rmdir fp recursive =
160156setenv :: String -> String -> Lua ()
161157setenv name value = ioToLua (Env. setEnv name value)
162158
159+ -- | Change current working directory.
160+ setwd :: FilePath -> Lua ()
161+ setwd fp = ioToLua $ Directory. setCurrentDirectory fp
162+
163163-- | Get the current directory for temporary files.
164164tmpdirname :: Lua FilePath
165165tmpdirname = ioToLua Directory. getTemporaryDirectory
0 commit comments