1
0
mirror of https://github.com/GNS3/gns3-server synced 2025-02-02 19:30:55 +00:00

Alternative method to find the Documents folder on Windows.

This commit is contained in:
grossmj 2016-03-28 19:37:34 -06:00
parent e167a81080
commit ba006f105f

View File

@ -594,8 +594,10 @@ class VMware(BaseManager):
""" """
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
from win32com.shell import shell, shellcon import ctypes
documents_folder = shell.SHGetSpecialFolderPath(None, shellcon.CSIDL_PERSONAL) path = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, 5, None, 0, path)
documents_folder = path.value
windows_type = sys.getwindowsversion().product_type windows_type = sys.getwindowsversion().product_type
if windows_type == 2 or windows_type == 3: if windows_type == 2 or windows_type == 3:
return '{}\My Virtual Machines'.format(documents_folder) return '{}\My Virtual Machines'.format(documents_folder)