diff options
author | James Cook <james@lindenlab.com> | 2010-01-15 12:02:56 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-01-15 12:02:56 -0800 |
commit | 4acf56d2a79a4f3bb555977aeaef21e15e26f684 (patch) | |
tree | ac0d8ff2225916323d9b942246edd458e04fd738 /scripts | |
parent | 3f83c05f7c71887825c907b0e148d81cd7de5324 (diff) | |
parent | c9cf84913d306103da51dc83e5932ff3fb308d32 (diff) |
Merge in viewer-2-0 changes
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install.py | 9 | ||||
-rwxr-xr-x | scripts/template_verifier.py | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/scripts/install.py b/scripts/install.py index 78b8880b95..7368af0b37 100755 --- a/scripts/install.py +++ b/scripts/install.py @@ -793,8 +793,13 @@ def _getuser(): import getpass return getpass.getuser() except ImportError: - import win32api - return win32api.GetUserName() + import ctypes + MAX_PATH = 260 # according to a recent WinDef.h + name = ctypes.create_unicode_buffer(MAX_PATH) + namelen = ctypes.c_int(len(name)) # len in chars, NOT bytes + if not ctypes.windll.advapi32.GetUserNameW(name, ctypes.byref(namelen)): + raise ctypes.WinError() + return name.value def _default_installable_cache(): """In general, the installable files do not change much, so find a diff --git a/scripts/template_verifier.py b/scripts/template_verifier.py index 8bb5e1d76d..d5fc119270 100755 --- a/scripts/template_verifier.py +++ b/scripts/template_verifier.py @@ -203,8 +203,13 @@ def getuser(): import getpass return getpass.getuser() except ImportError: - import win32api - return win32api.GetUserName() + import ctypes + MAX_PATH = 260 # according to a recent WinDef.h + name = ctypes.create_unicode_buffer(MAX_PATH) + namelen = ctypes.c_int(len(name)) # len in chars, NOT bytes + if not ctypes.windll.advapi32.GetUserNameW(name, ctypes.byref(namelen)): + raise ctypes.WinError() + return name.value def local_master_cache_filename(): """Returns the location of the master template cache (which is in the system tempdir) |