From 7c34af017a82265190d9c0d00e7c591df7e85fa0 Mon Sep 17 00:00:00 2001 From: CaiBin <342571403@qq.com> Date: Fri, 14 Jan 2022 22:18:02 +0800 Subject: [PATCH] Synchronized path.h/path.cpp --- misc/unittest/unittest/fs_sh/path.cpp | 6 ++++-- misc/unittest/unittest/fs_sh/path.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/misc/unittest/unittest/fs_sh/path.cpp b/misc/unittest/unittest/fs_sh/path.cpp index 7aff9fc..c13b167 100755 --- a/misc/unittest/unittest/fs_sh/path.cpp +++ b/misc/unittest/unittest/fs_sh/path.cpp @@ -94,7 +94,9 @@ DLLAPI(void) concat_path(const string& path1, const string& path2, string& merge path_array1.insert(path_array1.end(),path_array2.begin(),path_array2.end()); merge_path(merge, path_array1,dsym); } -DLLAPI(bool) is_subpath(const string& relative_path1, const string& relative_path2) +DLLAPI(bool) is_subpath(const string& relative_path1, const string& relative_path2, char dsym) { - return relative_path1.size()>relative_path2.size()&&relative_path1.substr(0,relative_path2.size())==relative_path2; + return relative_path1.size()>relative_path2.size() + &&relative_path1.substr(0,relative_path2.size())==relative_path2 + &&relative_path1[relative_path2.size()]==dsym; } diff --git a/misc/unittest/unittest/fs_sh/path.h b/misc/unittest/unittest/fs_sh/path.h index 908328a..5ea3efd 100755 --- a/misc/unittest/unittest/fs_sh/path.h +++ b/misc/unittest/unittest/fs_sh/path.h @@ -11,5 +11,5 @@ int get_absolute_path(const string& cur_dir, const vector& relative_path int get_absolute_path(const string& cur_dir, const string& relative_path, vector& absolute_path, char dsym=_dir_symbol); DLLAPI(int) get_absolute_path(const string& cur_dir, const string& relative_path, string& absolute_path, int (*is_absolute_path)(char* path, char dsym)=NULL, char dsym=_dir_symbol); DLLAPI(void) concat_path(const string& path1, const string& path2, string& merge, char dsym=_dir_symbol); -DLLAPI(bool) is_subpath(const string& relative_path1, const string& relative_path2); +DLLAPI(bool) is_subpath(const string& relative_path1, const string& relative_path2, char dsym=_dir_symbol); #endif \ No newline at end of file