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="\\")
| 152 | |
| 153 | |
| 154 | def _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 | |
| 180 | def _IsWindowsAbsPath(path): |
no test coverage detected