implement Path::join()
This commit is contained in:
parent
863fb2018b
commit
eb12420155
@ -22,8 +22,10 @@ namespace jes
|
||||
|
||||
Path Path::join(const Path & other)
|
||||
{
|
||||
// TODO
|
||||
return "";
|
||||
if (m_path.size() > 0 && *m_path.rbegin() == '/')
|
||||
return Path(m_path + other.m_path);
|
||||
else
|
||||
return Path(m_path + '/' + other.m_path);
|
||||
}
|
||||
|
||||
void Path::clean()
|
||||
|
@ -21,3 +21,9 @@ TEST(PathTest, convert_backslashes_to_forward_slashes)
|
||||
Path p("C:\\foo\\bar.txt");
|
||||
EXPECT_EQ("C:/foo/bar.txt", p.to_s());
|
||||
}
|
||||
|
||||
TEST(PathTest, joins_two_paths_together)
|
||||
{
|
||||
EXPECT_EQ("C:/foo/../baz", Path("C:\\foo").join("../baz").to_s());
|
||||
EXPECT_EQ("/xyz/f.txt", Path("/xyz/").join("f.txt").to_s());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user