diff options
author | erihel <erihel@gmail.com> | 2013-03-17 19:01:32 +0100 |
---|---|---|
committer | erihel <erihel@gmail.com> | 2013-03-17 19:01:32 +0100 |
commit | d6bbc99c90ef586b041651d373524b30fe6c8676 (patch) | |
tree | e01eee683dc4e693450769a441a37c9d070b97d1 /src/common/profile.h | |
parent | 9f5bef030d97e9ee20d8c635335fdafd854fed44 (diff) | |
download | colobot-d6bbc99c90ef586b041651d373524b30fe6c8676.tar.gz colobot-d6bbc99c90ef586b041651d373524b30fe6c8676.tar.bz2 colobot-d6bbc99c90ef586b041651d373524b30fe6c8676.zip |
* 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
Diffstat (limited to 'src/common/profile.h')
-rw-r--r-- | src/common/profile.h | 28 |
1 files changed, 27 insertions, 1 deletions
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 <boost/property_tree/ptree.hpp> +#include <boost/filesystem.hpp> +#include <boost/algorithm/string/replace.hpp> #include <string> #include <vector> +namespace fs = boost::filesystem; + /** * \class CProfile @@ -101,10 +107,30 @@ class CProfile : public CSingleton<CProfile> * \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 |