INNER CODE UNIT · TypeScript
normalizePathForComparison
ZaxbyHub/opencode-swarm · src/cli/index.ts:98
function normalizePathForComparison(value: string): string {
const normalized = path.normalize(path.resolve(value));
return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
}
/**
* Require a canonical cleanup target's parent to be the configured config
* directory itself. The configured root may be a symlink (for example, an
* XDG_CONFIG_HOME link), so resolve both sides before comparing them.
*/
function isExactConfiguredConfigChild(
canonicalTarget: string,
configuredDir: string,
): boolean {
const canonicalConfigDir = safeRealpathSync(configuredDir, configuredDir);
const canonicalParent = safeRealpathSync(
path.dirname(canonicalTarget),
path.dirname(canonicalTarget),