LLDB mainline
PathUtils.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_HOST_WINDOWS_PATHUTILS_H
10#define LLDB_HOST_WINDOWS_PATHUTILS_H
11
12#include "llvm/ADT/StringRef.h"
13
14#include <string>
15
16namespace lldb_private {
17
18/// Convert an extended-length path to a regular DOS path: "\\?\C:\a" becomes
19/// "C:\a" and "\\?\UNC\server\share" becomes "\\server\share". Other paths are
20/// returned unchanged.
21inline std::string StripExtendedLengthPrefix(llvm::StringRef path) {
22 if (path.consume_front("\\\\?\\UNC\\"))
23 return "\\\\" + path.str();
24 path.consume_front("\\\\?\\");
25 return path.str();
26}
27
28} // namespace lldb_private
29
30#endif // LLDB_HOST_WINDOWS_PATHUTILS_H
A class that represents a running process on the host machine.
std::string StripExtendedLengthPrefix(llvm::StringRef path)
Convert an extended-length path to a regular DOS path: "\\?\C:\a" becomes "C:\a" and "\\?...
Definition PathUtils.h:21