Skip to content

Commit 07e2fef

Browse files
committed
Bug: Resolving cross platform issues with the new Path class
1 parent c0c9175 commit 07e2fef

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

projects/biogears-common/include/biogears/filesystem/path.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ namespace filesystem {
124124
path make_normal() const
125125
{
126126
path working_path;
127+
working_path.m_absolute = m_absolute;
128+
working_path.m_type = m_type;
127129
for (auto& segment : m_path) {
128130
if (segment.empty()) {
129131

@@ -230,15 +232,16 @@ namespace filesystem {
230232
}
231233
path operator/(const path& other) const
232234
{
233-
if (other.m_absolute)
235+
if (other.m_absolute) {
234236
if (m_path.empty()) {
235237
return other;
236238
} else {
237239
throw std::runtime_error("path::operator/(): expected a relative path!");
238240
}
239-
if (m_type != other.m_type)
241+
}
242+
if (m_type != other.m_type) {
240243
throw std::runtime_error("path::operator/(): expected a path of the same type!");
241-
244+
}
242245
path result(*this);
243246

244247
for (size_t i = 0; i < other.m_path.size(); ++i)

projects/biogears-common/unit/test_common_Path.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ TEST_F(TEST_FIXTURE_NAME, Path_Empty)
8585

8686
EXPECT_TRUE(path_empty.empty());
8787
EXPECT_FALSE(path_relative.empty());
88-
88+
//This test is inconsistant across paltforms. Need to improve
8989
//EXPECT_FALSE(path_absolute_root.empty());
9090
}
9191

projects/biogears/unit/cdm/utils/test_core_FileUtils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ TEST_F(TEST_FIXTURE_NAME, FileUtils_ResolvePath)
7979
biogears::SetCurrentWorkingDirectory("");
8080
EXPECT_EQ(path::getcwd() / "test_file.txt", ResolvePath("test_file.txt"));
8181
EXPECT_EQ(path::getcwd() / "test_file.txt", ResolvePath("./test_file.txt"));
82-
EXPECT_EQ(path("C:/biogears/test_file.txt").make_normal(), ResolvePath("C:/biogears/test_file.txt"));
8382

8483
#ifdef _WIN32
8584
biogears::SetCurrentWorkingDirectory("C:/");

0 commit comments

Comments
 (0)