ccls/src/platform_win.cc
Ka Ho Ng 48f1a006b7
Reformat all the files after 192a82b (#979)
Since the introduction of "ColumnLimit: 120" in .clang-format, the
column limit has become 120 characters instead of 80 characters.

This prevents clang-format from generating too much changes even if just
a small portion of a source file or header file is modified.
2024-12-06 17:58:19 -08:00

46 lines
1000 B
C++

// Copyright 2017-2018 ccls Authors
// SPDX-License-Identifier: Apache-2.0
#if defined(_WIN32)
#include "platform.hh"
#include "utils.hh"
#include <Windows.h>
#include <direct.h>
#include <fcntl.h>
#include <io.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <algorithm>
#include <string>
#include <thread>
namespace ccls {
std::string normalizePath(llvm::StringRef path) {
TCHAR buffer[MAX_PATH] = TEXT("");
TCHAR **lpp_part = {NULL};
std::string result(path);
if (GetFullPathName(result.c_str(), MAX_PATH, buffer, lpp_part) != 0)
result = buffer;
std::replace(result.begin(), result.end(), '\\', '/');
// Normalize drive letter.
if (result.size() > 1 && result[0] >= 'a' && result[0] <= 'z' && result[1] == ':')
result[0] = toupper(result[0]);
return result;
}
void freeUnusedMemory() {}
// TODO Wait for debugger to attach
void traceMe() {}
void spawnThread(void *(*fn)(void *), void *arg) { std::thread(fn, arg).detach(); }
} // namespace ccls
#endif