diff dep/animia/src/util.cc @ 158:80d6b28eb29f

dep/animia: fix most X11 stuff it looks like _NET_WM_PID isn't supported by MOST clients, or my code is wrong... core/filesystem: fix Linux config path handling on *nix
author Paper <mrpapersonic@gmail.com>
date Fri, 17 Nov 2023 02:07:33 -0500
parents cdf79282d647
children
line wrap: on
line diff
--- a/dep/animia/src/util.cc	Thu Nov 16 16:51:34 2023 -0500
+++ b/dep/animia/src/util.cc	Fri Nov 17 02:07:33 2023 -0500
@@ -10,16 +10,14 @@
 
 bool ReadFile(const std::string& path, std::string& data) {
 	std::ifstream file(path.c_str(), std::ios::in | std::ios::binary);
-
 	if (!file)
 		return false;
 
-	file.seekg(0, std::ios::end);
-	data.resize(static_cast<size_t>(file.tellg()));
-	file.seekg(0, std::ios::beg);
+	std::ostringstream string;
+	string << file.rdbuf();
+	file.close();
 
-	file.read(&data.front(), data.size());
-	file.close();
+	data = string.str();
 
 	return true;
 }