Просмотр исходного кода

build: make literal paths portable

Use fs.path.sep_str instead of a slash, in literal paths.
Manlio Perillo 2 лет назад
Родитель
Сommit
e4e096c680
2 измененных файлов с 7 добавлено и 2 удалено
  1. 5 1
      build.zig
  2. 2 1
      test/tests.zig

+ 5 - 1
build.zig

@@ -124,7 +124,11 @@ pub fn build(b: *Build) !void {
     const override_healed_path = b.option([]const u8, "healed-path", "Override healed path");
     const exno: ?usize = b.option(usize, "n", "Select exercise");
 
-    const healed_path = if (override_healed_path) |path| path else "patches/healed";
+    const sep = std.fs.path.sep_str;
+    const healed_path = if (override_healed_path) |path|
+        path
+    else
+        "patches" ++ sep ++ "healed";
     const work_path = if (healed) healed_path else "exercises";
 
     const header_step = PrintStep.create(b, logo);

+ 2 - 1
test/tests.zig

@@ -435,10 +435,11 @@ const HealStep = struct {
 
 /// Heals all the exercises.
 fn heal(allocator: Allocator, exercises: []const Exercise, work_path: []const u8) !void {
+    const sep = std.fs.path.sep_str;
     const join = fs.path.join;
 
     const exercises_path = "exercises";
-    const patches_path = "patches/patches";
+    const patches_path = "patches" ++ sep ++ "patches";
 
     for (exercises) |ex| {
         const name = ex.name();