mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-19 08:00:01 +00:00
Make improvements
- Expand redbean UNIX module - Expand redbean documentation - Ensure Lua copyright is embedded in binary - Increase the PATH_MAX limit especially on NT - Use column major sorting for linenoise completions - Fix some suboptimalities in redbean's new UNIX API - Figured out right flags for Multics newline in raw mode
This commit is contained in:
parent
cf3174dc74
commit
2046c0d2ae
305 changed files with 6602 additions and 4221 deletions
|
@ -52,14 +52,21 @@ static textwindows bool GetNtExePath(char exe[SIZE]) {
|
|||
uint64_t w;
|
||||
wint_t x, y;
|
||||
uint32_t i, j;
|
||||
char16_t path16[PATH_MAX + 1];
|
||||
path16[0] = 0;
|
||||
rc = GetModuleFileName(0, path16, ARRAYLEN(path16));
|
||||
NTTRACE("GetModuleFileName(0, [%#hs]) → %hhhd", path16, rc);
|
||||
char16_t p[PATH_MAX + 1];
|
||||
p[0] = 0;
|
||||
rc = GetModuleFileName(0, p, ARRAYLEN(p));
|
||||
NTTRACE("GetModuleFileName(0, [%#hs]) → %hhhd", p, rc);
|
||||
if (!rc) return false;
|
||||
for (i = j = 0; (x = path16[i++] & 0xffff);) {
|
||||
j = 0;
|
||||
if (p[0] != '\\' || p[1] != '\\' || p[2] != '?' || p[3] != '\\') {
|
||||
exe[j++] = '/';
|
||||
exe[j++] = '/';
|
||||
exe[j++] = '?';
|
||||
exe[j++] = '/';
|
||||
}
|
||||
for (i = 0; (x = p[i++] & 0xffff);) {
|
||||
if (!IsUcs2(x)) {
|
||||
y = path16[i++] & 0xffff;
|
||||
y = p[i++] & 0xffff;
|
||||
x = MergeUtf16(x, y);
|
||||
}
|
||||
if (x == '\\') x = '/';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue