parameter -htmldir

This commit is contained in:
Miguel Freitas 2013-11-11 17:14:12 -02:00
parent 6957873a90
commit bc0519068a
4 changed files with 17 additions and 1 deletions

View File

@ -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 ) {

View File

@ -171,6 +171,7 @@ std::string HelpMessage()
strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n";
strUsage += " -gen " + _("Generate coins (default: 0)") + "\n";
strUsage += " -datadir=<dir> " + _("Specify data directory") + "\n";
strUsage += " -htmldir=<dir> " + _("Specify HTML directory to serve (default: <data>/html)") + "\n";
strUsage += " -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n";
strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n";
strUsage += " -proxy=<ip:port> " + _("Connect through socks proxy") + "\n";

View File

@ -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"));

View File

@ -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);