mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 06:20:55 +00:00
fix: stabilize windows temp and path handling
This commit is contained in:
@@ -115,13 +115,20 @@ function loadHookFromDir(params: {
|
||||
return null;
|
||||
}
|
||||
|
||||
let baseDir = params.hookDir;
|
||||
try {
|
||||
baseDir = fs.realpathSync.native(params.hookDir);
|
||||
} catch {
|
||||
// keep the discovered path when realpath is unavailable
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
description,
|
||||
source: params.source,
|
||||
pluginId: params.pluginId,
|
||||
filePath: hookMdPath,
|
||||
baseDir: params.hookDir,
|
||||
baseDir,
|
||||
handlerPath,
|
||||
};
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import { tmpdir as getOsTmpDir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
export const POSIX_OPENCLAW_TMP_DIR = "/tmp/openclaw";
|
||||
@@ -48,7 +48,7 @@ export function resolvePreferredOpenClawTmpDir(
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
const tmpdir = options.tmpdir ?? os.tmpdir;
|
||||
const tmpdir = typeof options.tmpdir === "function" ? options.tmpdir : getOsTmpDir;
|
||||
const uid = getuid();
|
||||
|
||||
const isSecureDirForUser = (st: { mode?: number; uid?: number }): boolean => {
|
||||
|
||||
@@ -35,8 +35,14 @@ function resolveDefaultLogDir(): string {
|
||||
return canUseNodeFs() ? resolvePreferredOpenClawTmpDir() : POSIX_OPENCLAW_TMP_DIR;
|
||||
}
|
||||
|
||||
function resolveDefaultLogFile(defaultLogDir: string): string {
|
||||
return canUseNodeFs()
|
||||
? path.join(defaultLogDir, "openclaw.log")
|
||||
: `${POSIX_OPENCLAW_TMP_DIR}/openclaw.log`;
|
||||
}
|
||||
|
||||
export const DEFAULT_LOG_DIR = resolveDefaultLogDir();
|
||||
export const DEFAULT_LOG_FILE = path.join(DEFAULT_LOG_DIR, "openclaw.log"); // legacy single-file path
|
||||
export const DEFAULT_LOG_FILE = resolveDefaultLogFile(DEFAULT_LOG_DIR); // legacy single-file path
|
||||
|
||||
const LOG_PREFIX = "openclaw";
|
||||
const LOG_SUFFIX = ".log";
|
||||
|
||||
@@ -70,6 +70,7 @@ const RUNTIME_API_EXPORT_GUARDS: Record<string, readonly string[]> = {
|
||||
'export * from "./src/auto-reply.js";',
|
||||
'export * from "./src/inbound.js";',
|
||||
'export * from "./src/login.js";',
|
||||
'export * from "./src/login-qr.js";',
|
||||
'export * from "./src/media.js";',
|
||||
'export * from "./src/send.js";',
|
||||
'export * from "./src/session.js";',
|
||||
|
||||
Reference in New Issue
Block a user