Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstarkos <none@none>2009-01-08 22:30:57 +0300
committerstarkos <none@none>2009-01-08 22:30:57 +0300
commit9be9bb1eb6bc84ad549e793e136cb4127ced9e2f (patch)
tree8a9573db140756871da8970e529a6406fc29b022 /src/host/os_copyfile.c
parent958b336cef6e02496afa2189e52040bfce4b1e3e (diff)
Added missing os_copyfile.c (doh!)
Diffstat (limited to 'src/host/os_copyfile.c')
-rw-r--r--src/host/os_copyfile.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/host/os_copyfile.c b/src/host/os_copyfile.c
new file mode 100644
index 0000000..6ec0a46
--- /dev/null
+++ b/src/host/os_copyfile.c
@@ -0,0 +1,34 @@
+/**
+ * \file os_copyfile.c
+ * \brief Copy a file from one location to another.
+ * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+
+
+int os_copyfile(lua_State* L)
+{
+ int z;
+ const char* src = luaL_checkstring(L, 1);
+ const char* dst = luaL_checkstring(L, 2);
+
+#if PLATFORM_WINDOWS
+ z = CopyFile(src, dst, FALSE);
+#else
+ luaL_pushfstring(L, "cp %s %s", src, dst);
+ z = (system(lua_tostring(L, -1)) == 0);
+#endif
+
+ if (!z)
+ {
+ lua_pushnil(L);
+ lua_pushfstring(L, "unable to copy file to '%s'", dst);
+ return 2;
+ }
+ else
+ {
+ lua_pushboolean(L, 1);
+ return 1;
+ }
+}