diff --git a/configure.ac b/configure.ac index b5893eedaa731..da6bdf4b7b259 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) -define(_CLIENT_VERSION_MINOR, 12) +define(_CLIENT_VERSION_MINOR, 13) define(_CLIENT_VERSION_REVISION, 0) -define(_CLIENT_VERSION_BUILD, 55) +define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([Dash Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dashpay.io],[dash]) diff --git a/src/clientversion.h b/src/clientversion.h index 9c51d8405cfe5..94057848e46da 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -15,9 +15,9 @@ //! These need to be macros, as clientversion.cpp's and dash*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 -#define CLIENT_VERSION_MINOR 12 +#define CLIENT_VERSION_MINOR 13 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 55 +#define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/evo/dapi.cpp b/src/evo/dapi.cpp index 8659cc15806f9..e5815dd6eaa42 100644 --- a/src/evo/dapi.cpp +++ b/src/evo/dapi.cpp @@ -5,16 +5,11 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. - #include "main.h" #include "core_io.h" #include "db.h" #include "init.h" #include "dapi.h" -#include "file.h" -#include "json/json_spirit.h" -#include "json/json_spirit_value.h" - int nError; std::string strErrorMessage; diff --git a/src/evo/dapi.h b/src/evo/dapi.h index d9762a6c8d6b4..49c8bb32c5781 100644 --- a/src/evo/dapi.h +++ b/src/evo/dapi.h @@ -30,40 +30,6 @@ using namespace std; using namespace json_spirit; -std::string GetProfileFile(std::string strUID) -{ - boost::filesystem::path filename = GetDataDirectory() / "users" / strUID; - return filename.c_str(); -} - -std::string GetPrivateDataFile(std::string strUID, int nSlot) -{ - std::string strFilename = strUID + "." + boost::lexical_cast(nSlot); - boost::filesystem::path filename = GetDataDirectory() / "users" / strFilename; - return filename.c_str(); -} - - -std::string escapeJsonString(const std::string& input) { - std::ostringstream ss; - for (auto iter = input.cbegin(); iter != input.cend(); iter++) { - //C++98/03: - //for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) { - switch (*iter) { - case '\\': ss << "\\\\"; break; - case '"': ss << "\\\""; break; - case '/': ss << "\\/"; break; - case '\b': ss << "\\b"; break; - case '\f': ss << "\\f"; break; - case '\n': ss << "\\n"; break; - case '\r': ss << "\\r"; break; - case '\t': ss << "\\t"; break; - default: ss << *iter; break; - } - } - return ss.str(); -} - class CDAPI { private: diff --git a/src/evo/file.h b/src/evo/file.h index 3f90025119647..e74490a8387b9 100644 --- a/src/evo/file.h +++ b/src/evo/file.h @@ -11,7 +11,6 @@ #include "compat/sanity.h" #include "key.h" #include "main.h" -#include "file.h" #include #include @@ -34,38 +33,6 @@ using namespace std; // TODO: What include is required for this? #define CLIENT_VERSION 1 -boost::filesystem::path GetDataDirectory() -{ - string strDataDir2 = GetArg("-datadir2", ""); - if(strDataDir2 != "") return strDataDir2; - - namespace fs = boost::filesystem; - // Windows < Vista: C:\Documents and Settings\Username\Application Data\Dash - // Windows >= Vista: C:\Users\Username\AppData\Roaming\Dash - // Mac: ~/Library/Application Support/Dash - // Unix: ~/.dash -#ifdef WIN32 - // Windows - return GetSpecialFolderPath(CSIDL_APPDATA) / "Dash"; -#else - fs::path pathRet; - char* pszHome = getenv("HOME"); - if (pszHome == NULL || strlen(pszHome) == 0) - pathRet = fs::path("/"); - else - pathRet = fs::path(pszHome); -#ifdef MAC_OSX - // Mac - pathRet /= "Library/Application Support"; - TryCreateDirectory(pathRet); - return pathRet / "DashData"; -#else - // Unix - return pathRet / ".dash-data"; -#endif -#endif -} - class CDriveFile { private: @@ -103,7 +70,7 @@ class CDriveFile ReadResult Read() { - std::ifstream t(strPath); + std::ifstream t(strPath.c_str()); std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); @@ -122,7 +89,7 @@ class CDriveFile { LOCK(cs); - ofstream os( strPath ); + ofstream os( strPath.c_str() ); json_spirit::write( obj, os ); os.close(); diff --git a/src/rpcdapi.cpp b/src/rpcdapi.cpp index 997b876139ed5..73eb8cfa505d5 100644 --- a/src/rpcdapi.cpp +++ b/src/rpcdapi.cpp @@ -9,15 +9,10 @@ #include "rpcserver.h" #include "utilmoneystr.h" #include "evo/dapi.h" -#include "evo/file.h" +// #include "evo/file.h" #include "util.h" -#include - -#include "json/json_spirit_value.h" -#include "univalue/univalue.h" - #include using namespace json_spirit; using namespace std; @@ -87,7 +82,7 @@ Value dapif(const Array& params, bool fHelp) */ std::string strPath = params[0].get_str(); - std::ifstream t(strPath); + std::ifstream t(strPath.c_str()); std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); diff --git a/src/util.cpp b/src/util.cpp index 42c1571f9d85a..19a66d61fbde4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -414,6 +414,71 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread) strMiscWarning = message; } +boost::filesystem::path GetDataDirectory() +{ + string strDataDir2 = GetArg("-datadir2", ""); + if(strDataDir2 != "") return strDataDir2; + + namespace fs = boost::filesystem; + // Windows < Vista: C:\Documents and Settings\Username\Application Data\Dash + // Windows >= Vista: C:\Users\Username\AppData\Roaming\Dash + // Mac: ~/Library/Application Support/Dash + // Unix: ~/.dash +#ifdef WIN32 + // Windows + return GetSpecialFolderPath(CSIDL_APPDATA) / "Dash"; +#else + fs::path pathRet; + char* pszHome = getenv("HOME"); + if (pszHome == NULL || strlen(pszHome) == 0) + pathRet = fs::path("/"); + else + pathRet = fs::path(pszHome); +#ifdef MAC_OSX + // Mac + pathRet /= "Library/Application Support"; + TryCreateDirectory(pathRet); + return pathRet / "DashData"; +#else + // Unix + return pathRet / ".dash-data"; +#endif +#endif +} + +std::string GetProfileFile(std::string strUID) +{ + boost::filesystem::path filename = GetDataDirectory() / "users" / strUID; + return filename.c_str(); +} + +std::string GetPrivateDataFile(std::string strUID, int nSlot) +{ + std::string strFilename = strUID + "." + boost::lexical_cast(nSlot); + boost::filesystem::path filename = GetDataDirectory() / "users" / strFilename; + return filename.c_str(); +} + +std::string escapeJsonString(const std::string& input) { + std::ostringstream ss; + //for (auto iter = input.cbegin(); iter != input.cend(); iter++) { + //C++98/03: + for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) { + switch (*iter) { + case '\\': ss << "\\\\"; break; + case '"': ss << "\\\""; break; + case '/': ss << "\\/"; break; + case '\b': ss << "\\b"; break; + case '\f': ss << "\\f"; break; + case '\n': ss << "\\n"; break; + case '\r': ss << "\\r"; break; + case '\t': ss << "\\t"; break; + default: ss << *iter; break; + } + } + return ss.str(); +} + boost::filesystem::path GetDefaultDataDir() { namespace fs = boost::filesystem; diff --git a/src/util.h b/src/util.h index 6127b69da5c17..49b87e61f1b9c 100644 --- a/src/util.h +++ b/src/util.h @@ -111,6 +111,13 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length); bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest); bool TryCreateDirectory(const boost::filesystem::path& p); boost::filesystem::path GetDefaultDataDir(); +boost::filesystem::path GetDataDirectory(); + +std::string GetProfileFile(std::string strUID); +std::string GetPrivateDataFile(std::string strUID, int nSlot); +std::string escapeJsonString(const std::string& input); + + const boost::filesystem::path &GetDataDir(bool fNetSpecific = true); boost::filesystem::path GetConfigFile(); boost::filesystem::path GetMasternodeConfigFile();