mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1438866 - Use proper path separators for windows. r=emilio
The indexer has paths handed to it on Windows with the backslash path separator. However it currently hard-codes the forward-slash Unix/macOS path separator, so we need to generify that code appropriately. MozReview-Commit-ID: Iy8bImt2BXW --HG-- extra : rebase_source : 4b88b44319c05ce816afc4e690d3d33d39b7e43c
This commit is contained in:
parent
eb8e51bd1d
commit
31c634d913
@ -27,11 +27,11 @@
|
||||
// the path.
|
||||
void ensurePath(std::string Path) {
|
||||
size_t Pos = 0;
|
||||
if (Path[0] == '/') {
|
||||
if (Path[0] == PATHSEP_CHAR) {
|
||||
Pos++;
|
||||
}
|
||||
|
||||
while ((Pos = Path.find('/', Pos)) != std::string::npos) {
|
||||
while ((Pos = Path.find(PATHSEP_CHAR, Pos)) != std::string::npos) {
|
||||
std::string Portion = Path.substr(0, Pos);
|
||||
if (!Portion.empty()) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
@ -11,6 +11,11 @@
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#define PATHSEP_CHAR '\\'
|
||||
#define PATHSEP_STRING "\\"
|
||||
#else
|
||||
#define PATHSEP_CHAR '/'
|
||||
#define PATHSEP_STRING "/"
|
||||
#endif
|
||||
|
||||
// Make sure that all directories on path exist, excluding the final element of
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
using namespace clang;
|
||||
|
||||
const std::string GENERATED("__GENERATED__/");
|
||||
const std::string GENERATED("__GENERATED__" PATHSEP_STRING);
|
||||
|
||||
// Absolute path to directory containing source code.
|
||||
std::string Srcdir;
|
||||
@ -1484,9 +1484,9 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
ensurePath(Args[1] + "/");
|
||||
ensurePath(Args[1] + PATHSEP_STRING);
|
||||
Outdir = getAbsolutePath(Args[1]);
|
||||
Outdir += "/";
|
||||
Outdir += PATHSEP_STRING;
|
||||
|
||||
Objdir = getAbsolutePath(Args[2]);
|
||||
if (Objdir.empty()) {
|
||||
@ -1496,7 +1496,7 @@ protected:
|
||||
D.Report(DiagID) << Args[2];
|
||||
return false;
|
||||
}
|
||||
Objdir += "/";
|
||||
Objdir += PATHSEP_STRING;
|
||||
|
||||
printf("MOZSEARCH: %s %s %s\n", Srcdir.c_str(), Outdir.c_str(),
|
||||
Objdir.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user