Skip to content

Commit c02926a

Browse files
committed
main: Ensure we don't accidentally move old HOME contents into .config/supertux2
Old bug reported by https://bugs.gentoo.org/764959, but just to be safe I've added an extra check to ensure this cannot happen again on purpose or by accident.
1 parent ee76219 commit c02926a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/supertux/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,13 @@ std::string physfs_userdir = PHYSFS_getUserDir();
334334
#ifdef _WIN32
335335
std::string olduserdir = FileSystem::join(physfs_userdir, PACKAGE_NAME);
336336
#else
337-
std::string olduserdir = FileSystem::join(physfs_userdir, "." PACKAGE_NAME);
337+
std::string olduserdir;
338+
// Extra safety check to ensure we can't move home.
339+
// See: https://bugs.gentoo.org/764959
340+
if (std::string(PACKAGE_NAME) == "")
341+
olduserdir = FileSystem::join(physfs_userdir, ".supertux2");
342+
else
343+
olduserdir = FileSystem::join(physfs_userdir, "." PACKAGE_NAME);
338344
#endif
339345
if (FileSystem::is_directory(olduserdir)) {
340346
std::filesystem::path olduserpath(olduserdir);

0 commit comments

Comments
 (0)