Commit f357a32f authored by Jason R. Coombs's avatar Jason R. Coombs

Simplify _get_content_dirname by simply removing the trailing backslash. Ref #995.

parent 3fa9efcb
...@@ -1010,7 +1010,7 @@ class EnvironmentInfo: ...@@ -1010,7 +1010,7 @@ class EnvironmentInfo:
elif self.vc_ver >= 15.0: elif self.vc_ver >= 15.0:
path = os.path.join(self.si.WindowsSdkDir, 'Bin') path = os.path.join(self.si.WindowsSdkDir, 'Bin')
arch_subdir = self.pi.current_dir(x64=True) arch_subdir = self.pi.current_dir(x64=True)
sdkver = self._get_content_dirname(path, slash=False) sdkver = self._get_content_dirname(path).rstrip('\\')
yield os.path.join(path, r'%s%s' % (sdkver, arch_subdir)) yield os.path.join(path, r'%s%s' % (sdkver, arch_subdir))
if self.si.WindowsSDKExecutablePath: if self.si.WindowsSDKExecutablePath:
...@@ -1243,7 +1243,7 @@ class EnvironmentInfo: ...@@ -1243,7 +1243,7 @@ class EnvironmentInfo:
seen_add(k) seen_add(k)
yield element yield element
def _get_content_dirname(self, path, slash=True): def _get_content_dirname(self, path):
""" """
Return name of the first dir in path or '' if no dir found. Return name of the first dir in path or '' if no dir found.
...@@ -1251,8 +1251,6 @@ class EnvironmentInfo: ...@@ -1251,8 +1251,6 @@ class EnvironmentInfo:
---------- ----------
path: str path: str
Path where search dir. Path where search dir.
slash: bool
If not True, only return "name" not "name\"
Return Return
------ ------
...@@ -1262,10 +1260,7 @@ class EnvironmentInfo: ...@@ -1262,10 +1260,7 @@ class EnvironmentInfo:
try: try:
name = os.listdir(path) name = os.listdir(path)
if name: if name:
name = name[0] return '%s\\' % name[0]
if slash:
return '%s\\' % name
return name
return '' return ''
except (OSError, IOError): except (OSError, IOError):
return '' return ''
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment