diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 930f818c..b17f4827 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -982,7 +982,7 @@ void ServiceConnection(AcceptedConnection *conn) ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto); if (strURI != "/" && strURI.find("..") == std::string::npos ) { - filesystem::path pathFile = filesystem::path(GetDataDir()) / "html" / strURI; + filesystem::path pathFile = filesystem::path(GetHTMLDir()) / strURI; std::string fname = pathFile.string(); size_t qMarkIdx = fname.find('?'); if( qMarkIdx != string::npos ) { diff --git a/src/init.cpp b/src/init.cpp index 9c5397dd..e5ecc5d1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -171,6 +171,7 @@ std::string HelpMessage() strUsage += " -pid= " + _("Specify pid file (default: bitcoind.pid)") + "\n"; strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; strUsage += " -datadir= " + _("Specify data directory") + "\n"; + strUsage += " -htmldir= " + _("Specify HTML directory to serve (default: /html)") + "\n"; strUsage += " -dbcache= " + _("Set database cache size in megabytes (default: 25)") + "\n"; strUsage += " -timeout= " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; strUsage += " -proxy= " + _("Connect through socks proxy") + "\n"; diff --git a/src/util.cpp b/src/util.cpp index 366d511c..fb0699d7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1085,6 +1085,20 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) return path; } +boost::filesystem::path GetHTMLDir() +{ + namespace fs = boost::filesystem; + fs::path path; + + if (mapArgs.count("-htmldir")) { + path = fs::system_complete(mapArgs["-htmldir"]); + } else { + path = GetDataDir() / "html"; + } + + return path; +} + boost::filesystem::path GetConfigFile() { boost::filesystem::path pathConfigFile(GetArg("-conf", "twister.conf")); diff --git a/src/util.h b/src/util.h index bee2749c..90a34c73 100644 --- a/src/util.h +++ b/src/util.h @@ -206,6 +206,7 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length); bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest); boost::filesystem::path GetDefaultDataDir(); const boost::filesystem::path &GetDataDir(bool fNetSpecific = true); +boost::filesystem::path GetHTMLDir(); boost::filesystem::path GetConfigFile(); boost::filesystem::path GetPidFile(); void CreatePidFile(const boost::filesystem::path &path, pid_t pid);