Skip to content

Commit 1eee061

Browse files
committed
thcrap: fix paths format in games.js
1 parent 10c0f97 commit 1eee061

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

thcrap/src/search.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ char *SearchDecideStoredPathForm(std::filesystem::path target, std::filesystem::
5353
}
5454

5555
if (target.root_path() != self.root_path()) {
56-
return strdup(target.u8string().c_str());
56+
return strdup(target.generic_u8string().c_str());
5757
}
5858

5959
auto [self_diff, target_diff] = std::mismatch(self.begin(), self.end(), target.begin(), target.end());
6060
// These numbers were decided arbitrarly by making a list of path examples that seemed
6161
// to make sense and looking at which values they need.
6262
// These examples are available in the unit tests.
6363
if (iter_size(self_diff, self.end()) <= 3 && iter_size(target_diff, target.end()) <= 2) {
64-
return strdup(target.lexically_relative(self).u8string().c_str());
64+
return strdup(target.lexically_relative(self).generic_u8string().c_str());
6565
}
6666
else {
67-
return strdup(target.u8string().c_str());
67+
return strdup(target.generic_u8string().c_str());
6868
}
6969
}
7070

thcrap_test/src/search.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ static void test(const char *self, const char *target, const char *expected)
2626

2727
TEST(Search, SearchDecideStoredPathForm)
2828
{
29-
test("C:\\a\\1\\2\\3\\4\\5\\6\\", "C:\\b\\1\\2\\3\\4\\5\\6", nullptr);
30-
test("D:\\thcrap\\", "E:\\th07\\th07.exe", nullptr);
31-
test("C:\\Users\\brliron\\Downlods\\thcrap\\", "C:\\Program Files\\Steam\\common\\th07\\th07.exe", nullptr);
32-
test("C:\\Users\\brliron\\Desktop\\games\\tools\\thcrap\\", "C:\\Users\\brliron\\Desktop\\games\\th07\\th07.exe", "..\\..\\th07\\th07.exe");
33-
test("C:\\Users\\brliron\\Desktop\\games\\th07\\thcrap\\", "C:\\Users\\brliron\\Desktop\\games\\th07\\th07.exe", "..\\th07.exe");
34-
test("C:\\Users\\brliron\\Desktop\\games\\", "C:\\Users\\brliron\\Desktop\\games\\th07\\th07.exe", "th07\\th07.exe");
35-
test("D:\\thcrap\\", "D:\\th07\\th07.exe", "..\\th07\\th07.exe");
29+
test("C:/a/1/2/3/4/5/6/", "C:/b/1/2/3/4/5/6", nullptr);
30+
test("D:/thcrap/", "E:/th07/th07.exe", nullptr);
31+
test("C:/Users/brliron/Downlods/thcrap/", "C:/Program Files/Steam/common/th07/th07.exe", nullptr);
32+
test("C:/Users/brliron/Desktop/games/tools/thcrap/", "C:/Users/brliron/Desktop/games/th07/th07.exe", "../../th07/th07.exe");
33+
test("C:/Users/brliron/Desktop/games/th07/thcrap/", "C:/Users/brliron/Desktop/games/th07/th07.exe", "../th07.exe");
34+
test("C:/Users/brliron/Desktop/games/", "C:/Users/brliron/Desktop/games/th07/th07.exe", "th07/th07.exe");
35+
test("D:/thcrap/", "D:/th07/th07.exe", "../th07/th07.exe");
3636
}

thcrap_test/src/search_for_games.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ TEST_F(SearchForGamesTest, TestSearchNormalFile)
7575

7676
game_search_result *found = SearchForGames(dirlist, nullptr);
7777
ASSERT_NE(found, nullptr);
78-
EXPECT_STREQ(found[0].path, "testdir\\abc.exe");
78+
EXPECT_STREQ(found[0].path, "testdir/abc.exe");
7979
EXPECT_STREQ(found[0].id, "th_abc");
8080
EXPECT_STREQ(found[0].build, "v1.00");
8181
EXPECT_STREQ(found[0].description, "v1.00 (original)");

0 commit comments

Comments
 (0)