refactor(repl): use bun.path.join for history path construction

Replace std.fs.path.join with bun.path.join for cross-platform path
construction as suggested in code review. The bun.path helper provides
consistent path handling across platforms.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2026-01-20 22:14:58 +00:00
parent aa5ea829a2
commit a1fde6caad

View File

@@ -1411,8 +1411,11 @@ pub const History = struct {
// Try to get home directory from environment
const home = bun.getenvZ("HOME") orelse bun.getenvZ("USERPROFILE") orelse return null;
// Build path: $HOME/.bun_repl_history using proper path joining for cross-platform support
const path = std.fs.path.join(self.allocator, &.{ home, HISTORY_FILE_NAME }) catch return null;
// Build path: $HOME/.bun_repl_history using Bun's path helper for cross-platform support
// bun.path.join returns a slice into a thread-local buffer, so we need to dupe it
const parts = [_][]const u8{ home, HISTORY_FILE_NAME };
const joined = bun.path.join(&parts, .auto);
const path = self.allocator.dupe(u8, joined) catch return null;
return path;
}