diff src/core/filesystem.cc @ 138:28842a8d0c6b

dep/animia: huge refactor (again...) but this time, it actually compiles! and it WORKS! (on win32... not sure about other platforms...) configuring players is still not supported: at some point I'll prune something up...
author Paper <mrpapersonic@gmail.com>
date Sun, 12 Nov 2023 04:53:19 -0500
parents 7d3ad9529c4c
children 80d6b28eb29f
line wrap: on
line diff
--- a/src/core/filesystem.cc	Fri Nov 10 13:52:47 2023 -0500
+++ b/src/core/filesystem.cc	Sun Nov 12 04:53:19 2023 -0500
@@ -43,15 +43,14 @@
 #elif defined(MACOSX)
 	return std::filesystem::path(osx::GetApplicationSupportDirectory()) / CONFIG_DIR;
 #else // just assume POSIX
+	std::filesystem::path path;
 	const char* home = getenv("HOME");
-	if (home != NULL)
-		path = home;
 #	ifdef __linux__
-	else
-		path = getpwuid(getuid())->pw_dir;
+	if (!home)
+		home = getpwuid(getuid())->pw_dir;
 #	endif // __linux__
-	if (!path.empty())
-		return path / ".config";
+	if (!home)
+		return std::filesystem::path(home) / ".config";
 	else
 		return std::filesystem::path();
 #endif     // !WIN32 && !MACOSX