normalize paths when doing file-path <-> eval string

This commit is contained in:
Ryan Fleury
2024-10-16 13:33:47 -07:00
parent 38173a7154
commit 938af75efb
+4 -2
View File
@@ -2846,7 +2846,8 @@ rd_file_path_from_eval_string(Arena *arena, String8 string)
E_Eval eval = e_eval_from_string(scratch.arena, string); E_Eval eval = e_eval_from_string(scratch.arena, string);
if(eval.expr->kind == E_ExprKind_LeafFilePath) if(eval.expr->kind == E_ExprKind_LeafFilePath)
{ {
result = raw_from_escaped_str8(arena, eval.expr->string); result = raw_from_escaped_str8(scratch.arena, eval.expr->string);
result = path_normalized_from_string(arena, result);
} }
scratch_end(scratch); scratch_end(scratch);
} }
@@ -2857,7 +2858,8 @@ internal String8
rd_eval_string_from_file_path(Arena *arena, String8 string) rd_eval_string_from_file_path(Arena *arena, String8 string)
{ {
Temp scratch = scratch_begin(&arena, 1); Temp scratch = scratch_begin(&arena, 1);
String8 string_escaped = escaped_from_raw_str8(scratch.arena, string); String8 string_normalized = path_normalized_from_string(scratch.arena, string);
String8 string_escaped = escaped_from_raw_str8(scratch.arena, string_normalized);
String8 result = push_str8f(arena, "file:\"%S\"", string_escaped); String8 result = push_str8f(arena, "file:\"%S\"", string_escaped);
scratch_end(scratch); scratch_end(scratch);
return result; return result;