summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/host/simple_host_process.cc13
-rwxr-xr-xremoting/tools/gettoken.py2
-rwxr-xr-xremoting/tools/register_host.py8
-rwxr-xr-xremoting/tools/runclient.py2
4 files changed, 17 insertions, 8 deletions
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 09f6a96..0f12c43 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -43,12 +43,13 @@
#if defined(OS_WIN)
const std::wstring kDefaultConfigPath = L".ChromotingConfig.json";
+const wchar_t kHomeDrive[] = L"HOMEDRIVE";
const wchar_t kHomePath[] = L"HOMEPATH";
const wchar_t* GetEnvironmentVar(const wchar_t* x) { return _wgetenv(x); }
#else
-static char* GetEnvironmentVar(const char* x) { return getenv(x); }
-const char kHomePath[] = "HOME";
const std::string kDefaultConfigPath = ".ChromotingConfig.json";
+const char kHomePath[] = "HOME";
+static char* GetEnvironmentVar(const char* x) { return getenv(x); }
#endif
const std::string kFakeSwitchName = "fake";
@@ -81,7 +82,13 @@ int main(int argc, char** argv) {
// Check the argument to see if we should use a fake capturer and encoder.
bool fake = cmd_line->HasSwitch(kFakeSwitchName);
- FilePath config_path(GetEnvironmentVar(kHomePath));
+#if defined(OS_WIN)
+ std::wstring path = GetEnvironmentVar(kHomeDrive);
+ path += GetEnvironmentVar(kHomePath);
+#else
+ std::string path = GetEnvironmentVar(kHomePath);
+#endif
+ FilePath config_path(path);
config_path = config_path.Append(kDefaultConfigPath);
if (cmd_line->HasSwitch(kConfigSwitchName)) {
config_path = cmd_line->GetSwitchValuePath(kConfigSwitchName);
diff --git a/remoting/tools/gettoken.py b/remoting/tools/gettoken.py
index a4024d7..d066bb8 100755
--- a/remoting/tools/gettoken.py
+++ b/remoting/tools/gettoken.py
@@ -13,7 +13,7 @@ import urllib
import gaia_auth
-auth_filepath = os.path.join(os.getenv('HOME'), '.chromotingAuthToken')
+auth_filepath = os.path.join(os.path.expanduser('~'), '.chromotingAuthToken')
print "Email:",
email = raw_input()
diff --git a/remoting/tools/register_host.py b/remoting/tools/register_host.py
index 11e5e4c..5518818 100755
--- a/remoting/tools/register_host.py
+++ b/remoting/tools/register_host.py
@@ -12,6 +12,7 @@ import os
import urllib
import urllib2
import uuid
+import socket
import sys
import gaia_auth
@@ -19,7 +20,8 @@ import gaia_auth
server = 'www-googleapis-test.sandbox.google.com'
url = 'http://' + server + '/chromoting/v1/@me/hosts'
-settings_filepath = os.path.join(os.getenv('HOME'), '.ChromotingConfig.json')
+settings_filepath = os.path.join(os.path.expanduser('~'),
+ '.ChromotingConfig.json')
print "Email:",
email = raw_input()
@@ -30,9 +32,9 @@ xapi_token = xapi_auth.authenticate(email, password)
host_id = str(uuid.uuid1())
print "HostId:", host_id
-host_name = os.uname()[1]
+host_name = socket.gethostname()
print "HostName:", host_name
-# TODO(sergeyu): Implement keypair generaion.
+# TODO(sergeyu): Implement keypair generation.
public_key = '123123'
jingle_id = ''
diff --git a/remoting/tools/runclient.py b/remoting/tools/runclient.py
index 17ba8da..12a4c5f 100755
--- a/remoting/tools/runclient.py
+++ b/remoting/tools/runclient.py
@@ -11,7 +11,7 @@
import os
import platform
-auth_filepath = os.path.join(os.getenv('HOME'), '.chromotingAuthToken')
+auth_filepath = os.path.join(os.path.expanduser('~'), '.chromotingAuthToken')
script_path = os.path.dirname(__file__)
if platform.system() == "Windows":