Skip to content

Commit

Permalink
Merge pull request cocos2d#6284 from natural-law/issue4849
Browse files Browse the repository at this point in the history
The environment variable take effect without reboot machine on windows
  • Loading branch information
minggo committed Apr 15, 2014
2 parents 6c86114 + 4fc0b0d commit b950a22
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions setup.py
Expand Up @@ -449,6 +449,10 @@ def set_console_root(self):

self._set_environment_variable(COCOS_CONSOLE_ROOT, cocos_consle_root)
else:
if old_dir == cocos_consle_root:
# is same with before, nothing to do
return

# update the environment variable
if self._isWindows():
self.remove_dir_from_win_path(old_dir)
Expand Down Expand Up @@ -597,3 +601,12 @@ def set_environment_variables(self, ndk_root, android_sdk_root, ant_root):
# set environment variables
env = SetEnvVar()
env.set_environment_variables(opts.ndk_root, opts.android_sdk_root, opts.ant_root)

if env._isWindows():
import ctypes
HWND_BROADCAST = 0xFFFF
WM_SETTINGCHANGE = 0x1A
SMTO_ABORTIFHUNG = 0x0002
result = ctypes.c_long()
SendMessageTimeoutW = ctypes.windll.user32.SendMessageTimeoutW
SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, u'Environment', SMTO_ABORTIFHUNG, 5000, ctypes.byref(result))

0 comments on commit b950a22

Please sign in to comment.