MCPcopy Create free account
hub / github.com/nodejs/node / _FixPath

Function _FixPath

tools/gyp/pylib/gyp/generator/msvs.py:154–177  ·  view source on GitHub ↗

Convert paths to a form that will make sense in a vcproj file. Arguments: path: The path to convert, may contain / etc. Returns: The path with all slashes made into backslashes.

(path, separator="\\")

Source from the content-addressed store, hash-verified

152
153
154def _FixPath(path, separator="\\"):
155 """Convert paths to a form that will make sense in a vcproj file.
156
157 Arguments:
158 path: The path to convert, may contain / etc.
159 Returns:
160 The path with all slashes made into backslashes.
161 """
162 if (
163 fixpath_prefix
164 and path
165 and not os.path.isabs(path)
166 and path[0] != "$"
167 and not _IsWindowsAbsPath(path)
168 ):
169 path = os.path.join(fixpath_prefix, path)
170 if separator == "\\":
171 path = path.replace("/", "\\")
172 path = _NormalizedSource(path)
173 if separator == "/":
174 path = path.replace("\\", "/")
175 if path and path[-1] == separator:
176 path = path[:-1]
177 return path
178
179
180def _IsWindowsAbsPath(path):

Callers 15

_FixPathsFunction · 0.85
_AdjustSourcesForRulesFunction · 0.85
_GetModuleDefinitionFunction · 0.85
_GetMSVSAttributesFunction · 0.85
DisableForSourceTreeFunction · 0.85
_GetCopiesFunction · 0.85
_GetMSBuildAttributesFunction · 0.85

Calls 3

_IsWindowsAbsPathFunction · 0.85
_NormalizedSourceFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected