From d6bbc99c90ef586b041651d373524b30fe6c8676 Mon Sep 17 00:00:00 2001 From: erihel Date: Sun, 17 Mar 2013 19:01:32 +0100 Subject: * Changed file loading to fix issue #73 * Moved few functions from misc.cpp to profile.cpp (used to set/get user dir) * Removed some warnings * More work to change const char* to std::string * Some work on file path to fix issue #60 with bad slashes on POSIX platform --- src/common/profile.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/common/profile.h') diff --git a/src/common/profile.h b/src/common/profile.h index 9bc6c37..bcd76c3 100644 --- a/src/common/profile.h +++ b/src/common/profile.h @@ -21,14 +21,20 @@ #pragma once - #include "common/singleton.h" +// this is just to fix problem with undefined reference when compiling with c++11 support +#define BOOST_NO_SCOPED_ENUMS + #include +#include +#include #include #include +namespace fs = boost::filesystem; + /** * \class CProfile @@ -101,10 +107,30 @@ class CProfile : public CSingleton * \return vector of values */ std::vector< std::string > GetLocalProfileSection(std::string section, std::string key); + + /** Sets current user directory + * \param dir + */ + void SetUserDir(std::string dir); + + /** Returns path based on current user. Replaces %user% in path with current user dir or + * uses default_dir param if no user dir is specified + * \param dir + * \param default_dir + * \return path + */ + std::string GetUserBasedPath(std::string dir, std::string default_dir); + + /** opy a file into the temporary folder. + * \param filename + * \return true on success + */ + bool CopyFileToTemp(std::string filename); private: boost::property_tree::ptree m_propertyTree; bool m_profileNeedSave; + std::string m_userDirectory; }; //! Global function to get profile instance -- cgit v1.2.3-1-g7c22