summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-29 10:55:31 +0800
committerruki <[email protected]>2017-03-29 10:55:31 +0800
commit0d22564e5a9062f83830739998e4b237bd3cf0e9 (patch)
tree5be87d6d9ee3a0fdd329bc1193fd742461ff0856
parent6a9d1d8a0dd915705e296e73f50d4d48ada7b3aa (diff)
update tbox to fix copy file for macosx
-rw-r--r--core/pkg/tbox.pkg/inc/macosx/tbox.config.h3
-rw-r--r--core/pkg/tbox.pkg/inc/tbox/platform/file.h7
-rw-r--r--core/pkg/tbox.pkg/inc/tbox/platform/path.h10
-rw-r--r--core/pkg/tbox.pkg/inc/tbox/platform/platform.h1
-rw-r--r--core/pkg/tbox.pkg/inc/tbox/platform/syserror.h56
-rw-r--r--core/pkg/tbox.pkg/inc/tbox/prefix/state.h14
-rw-r--r--core/pkg/tbox.pkg/lib/release/macosx/x86_64/libtbox.abin639520 -> 640064 bytes
-rw-r--r--xmake/actions/install/main.lua3
-rw-r--r--xmake/actions/uninstall/main.lua3
9 files changed, 84 insertions, 13 deletions
diff --git a/core/pkg/tbox.pkg/inc/macosx/tbox.config.h b/core/pkg/tbox.pkg/inc/macosx/tbox.config.h
index 6b8d23b50..852277975 100644
--- a/core/pkg/tbox.pkg/inc/macosx/tbox.config.h
+++ b/core/pkg/tbox.pkg/inc/macosx/tbox.config.h
@@ -6,7 +6,7 @@
#define TB_CONFIG_VERSION_MAJOR 1
#define TB_CONFIG_VERSION_MINOR 6
#define TB_CONFIG_VERSION_ALTER 2
-#define TB_CONFIG_VERSION_BUILD 201703202239
+#define TB_CONFIG_VERSION_BUILD 201703291045
// defines
#define TB_CONFIG_OS_MACOSX 1
@@ -107,6 +107,7 @@
#define TB_CONFIG_POSIX_HAVE_REGEXEC 1
#define TB_CONFIG_POSIX_HAVE_READV 1
#define TB_CONFIG_POSIX_HAVE_WRITEV 1
+#define TB_CONFIG_POSIX_HAVE_COPYFILE 1
#define TB_CONFIG_POSIX_HAVE_POSIX_SPAWNP 1
#define TB_CONFIG_POSIX_HAVE_EXECVP 1
#define TB_CONFIG_POSIX_HAVE_FORK 1
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/file.h b/core/pkg/tbox.pkg/inc/tbox/platform/file.h
index f75bb174b..4bc7bd59f 100644
--- a/core/pkg/tbox.pkg/inc/tbox/platform/file.h
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/file.h
@@ -63,9 +63,10 @@ typedef enum __tb_file_mode_t
, TB_FILE_MODE_CREAT = 8 //!< create
, TB_FILE_MODE_APPEND = 16 //!< append
, TB_FILE_MODE_TRUNC = 32 //!< truncate
-, TB_FILE_MODE_BINARY = 64 //!< binary
-, TB_FILE_MODE_DIRECT = 128 //!< direct, no cache, @note data & size must be aligned by TB_FILE_DIRECT_ASIZE
-, TB_FILE_MODE_ASIO = 256 //!< support for asio
+, TB_FILE_MODE_DIRECT = 64 //!< direct, no cache, @note data & size must be aligned by TB_FILE_DIRECT_ASIZE
+, TB_FILE_MODE_ASIO = 128 //!< support for asio
+
+, TB_FILE_MODE_BINARY = 256 //!< binary (deprecated)
}tb_file_mode_t;
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/path.h b/core/pkg/tbox.pkg/inc/tbox/platform/path.h
index a12721295..fdd2f1ab0 100644
--- a/core/pkg/tbox.pkg/inc/tbox/platform/path.h
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/path.h
@@ -111,6 +111,16 @@ tb_char_t const* tb_path_relative(tb_char_t const* path, tb_char_t* data,
*/
tb_char_t const* tb_path_relative_to(tb_char_t const* root, tb_char_t const* path, tb_char_t* data, tb_size_t maxn);
+/*! get the directory of path
+ *
+ * @param path the path
+ * @param data the path data
+ * @param maxn the path maxn
+ *
+ * @return the directory of path
+ */
+tb_char_t const* tb_path_directory(tb_char_t const* path, tb_char_t* data, tb_size_t maxn);
+
/* //////////////////////////////////////////////////////////////////////////////////////
* extern
*/
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/platform.h b/core/pkg/tbox.pkg/inc/tbox/platform/platform.h
index 5f968c29e..190b31e9c 100644
--- a/core/pkg/tbox.pkg/inc/tbox/platform/platform.h
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/platform.h
@@ -49,6 +49,7 @@
#include "barrier.h"
#include "dynamic.h"
#include "process.h"
+#include "syserror.h"
#include "addrinfo.h"
#include "spinlock.h"
#include "atomic64.h"
diff --git a/core/pkg/tbox.pkg/inc/tbox/platform/syserror.h b/core/pkg/tbox.pkg/inc/tbox/platform/syserror.h
new file mode 100644
index 000000000..e19bfda1d
--- /dev/null
+++ b/core/pkg/tbox.pkg/inc/tbox/platform/syserror.h
@@ -0,0 +1,56 @@
+/*!The Treasure Box Library
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Copyright (C) 2009 - 2017, TBOOX Open Source Group.
+ *
+ * @author ruki
+ * @file syserror.h
+ * @ingroup platform
+ *
+ */
+#ifndef TB_PLATFORM_SYSERROR_H
+#define TB_PLATFORM_SYSERROR_H
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_enter__
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * interfaces
+ */
+
+/*! get the last system error state
+ *
+ * @note the error code see state.h
+ *
+ * @return the last system error state
+ */
+tb_size_t tb_syserror_state(tb_noarg_t);
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * extern
+ */
+__tb_extern_c_leave__
+
+#endif
diff --git a/core/pkg/tbox.pkg/inc/tbox/prefix/state.h b/core/pkg/tbox.pkg/inc/tbox/prefix/state.h
index 1247867a7..7d3baa8cd 100644
--- a/core/pkg/tbox.pkg/inc/tbox/prefix/state.h
+++ b/core/pkg/tbox.pkg/inc/tbox/prefix/state.h
@@ -53,9 +53,9 @@ typedef enum __tb_state_type_e
{
TB_STATE_TYPE_NONE = 0
, TB_STATE_TYPE_SOCK = 1
-, TB_STATE_TYPE_FILE = 2
-, TB_STATE_TYPE_HTTP = 3
-, TB_STATE_TYPE_DATABASE = 4
+, TB_STATE_TYPE_HTTP = 2
+, TB_STATE_TYPE_DATABASE = 3
+, TB_STATE_TYPE_SYSERROR = 4
}tb_state_type_e;
@@ -87,10 +87,6 @@ typedef enum __tb_state_e
, TB_STATE_NOT_SUPPORTED = TB_STATE_DEFINE(TB_STATE_TYPE_NONE, 22)
, TB_STATE_UNKNOWN_ERROR = TB_STATE_DEFINE(TB_STATE_TYPE_NONE, 23)
-, TB_STATE_FILE_NOT_EXISTS = TB_STATE_DEFINE(TB_STATE_TYPE_FILE, 1)
-, TB_STATE_FILE_OPEN_FAILED = TB_STATE_DEFINE(TB_STATE_TYPE_FILE, 2)
-, TB_STATE_FILE_UNKNOWN_ERROR = TB_STATE_DEFINE(TB_STATE_TYPE_FILE, 3)
-
, TB_STATE_SOCK_DNS_FAILED = TB_STATE_DEFINE(TB_STATE_TYPE_SOCK, 1)
, TB_STATE_SOCK_CONNECT_FAILED = TB_STATE_DEFINE(TB_STATE_TYPE_SOCK, 2)
, TB_STATE_SOCK_CONNECT_TIMEOUT = TB_STATE_DEFINE(TB_STATE_TYPE_SOCK, 3)
@@ -166,6 +162,10 @@ typedef enum __tb_state_e
, TB_STATE_DATABASE_UNKNOWN_HOST = TB_STATE_DEFINE(TB_STATE_TYPE_DATABASE, 7)
, TB_STATE_DATABASE_UNKNOWN_ERROR = TB_STATE_DEFINE(TB_STATE_TYPE_DATABASE, 8)
+, TB_STATE_SYSERROR_NOT_PERM = TB_STATE_DEFINE(TB_STATE_TYPE_SYSERROR, 1)
+, TB_STATE_SYSERROR_NOT_FILEDIR = TB_STATE_DEFINE(TB_STATE_TYPE_SYSERROR, 2)
+, TB_STATE_SYSERROR_UNKNOWN_ERROR = TB_STATE_DEFINE(TB_STATE_TYPE_SYSERROR, 3)
+
}tb_state_e;
/* //////////////////////////////////////////////////////////////////////////////////////
diff --git a/core/pkg/tbox.pkg/lib/release/macosx/x86_64/libtbox.a b/core/pkg/tbox.pkg/lib/release/macosx/x86_64/libtbox.a
index 7a4c58bf2..1ec5630fa 100644
--- a/core/pkg/tbox.pkg/lib/release/macosx/x86_64/libtbox.a
+++ b/core/pkg/tbox.pkg/lib/release/macosx/x86_64/libtbox.a
Binary files differ
diff --git a/xmake/actions/install/main.lua b/xmake/actions/install/main.lua
index 8923a7b86..2b4a4663b 100644
--- a/xmake/actions/install/main.lua
+++ b/xmake/actions/install/main.lua
@@ -69,7 +69,8 @@ function main()
-- get answer
io.flush()
- if io.read() == 'y' then
+ local answer = io.read()
+ if answer == 'y' or answer == '' then
-- install target with administrator permission
os.sudol(os.runv, path.join(os.scriptdir(), "install_admin.lua"), {targetname, option.get("installdir")})
diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua
index 69f96fc87..9063fbda2 100644
--- a/xmake/actions/uninstall/main.lua
+++ b/xmake/actions/uninstall/main.lua
@@ -69,7 +69,8 @@ function main()
-- get answer
io.flush()
- if io.read() == 'y' then
+ local answer = io.read()
+ if answer == 'y' or answer == '' then
-- uninstall target with administrator permission
os.sudol(os.runv, path.join(os.scriptdir(), "uninstall_admin.lua"), {targetname, option.get("installdir")})