|
From: Johnny O. <js...@us...> - 2010-10-28 20:46:29
|
Module: performous
Branch: opengl2
Commit: 7d197dec9de7b77a8bbb72b3df9186e433816efd
Author: Tapio Vierros <tap...@gm...>
Date: Sun Oct 24 13:07:51 2010 +0300
Handle Windows drive names in backgrounds' cache path construction.
---
game/cache.cc | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/game/cache.cc b/game/cache.cc
index e549763..69974e2 100644
--- a/game/cache.cc
+++ b/game/cache.cc
@@ -1,8 +1,9 @@
#include "cache.hh"
-
#include "fs.hh"
#include <boost/format.hpp>
+#include <algorithm>
+#include <boost/algorithm/string/classification.hpp>
namespace cache {
fs::path constructSVGCacheFileName(fs::path const& svgfilename, double factor){
@@ -16,7 +17,10 @@ namespace cache {
} else {
// We use the full path under cache to avoid name collisions
// with images other than theme files (mostly backgrounds).
- cache_filename = getCacheDir() / "misc" / svgfilename.parent_path() / cache_basename;
+ std::string fullpath = svgfilename.parent_path().string();
+ // Windows drive name handling
+ std::replace_if(fullpath.begin(), fullpath.end(), boost::is_any_of(":"), '_');
+ cache_filename = getCacheDir() / "misc" / fullpath / cache_basename;
}
return cache_filename;
|