mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
fix filename_to_name_ex
This commit is contained in:
parent
626931230d
commit
72383f2b3c
@ -1,4 +1,8 @@
|
||||
# 最新动态
|
||||
* 2019/03/27
|
||||
* 修改style mutable的BUG(感谢朝泽提供补丁)
|
||||
* 修改utils的BUG(感谢朝泽提供补丁)
|
||||
|
||||
* 2019/03/25
|
||||
* 修改issue #101(感谢俊杰提供补丁)
|
||||
* 修改issue #100。
|
||||
|
@ -477,7 +477,7 @@ ret_t filename_to_name_ex(const char* filename, char* str, uint32_t size, bool_t
|
||||
tk_strncpy(str, name, size - 1);
|
||||
|
||||
if (remove_extname) {
|
||||
p = strchr(str, '.');
|
||||
p = strrchr(str, '.');
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
@ -184,6 +184,13 @@ TEST(Utils, filename_to_name_ex) {
|
||||
ASSERT_EQ(string(name), string("test"));
|
||||
}
|
||||
|
||||
TEST(Utils, filename_to_name_ex_dot) {
|
||||
char name[TK_NAME_LEN + 1];
|
||||
|
||||
filename_to_name_ex("/a/app.test.png", name, TK_NAME_LEN, TRUE);
|
||||
ASSERT_EQ(string(name), string("app.test"));
|
||||
}
|
||||
|
||||
TEST(Utils, tk_skip_to_num) {
|
||||
ASSERT_EQ(tk_atoi(tk_skip_to_num("123")), 123);
|
||||
ASSERT_EQ(tk_atoi(tk_skip_to_num("abc123")), 123);
|
||||
|
Loading…
Reference in New Issue
Block a user