Browse Source

Merge remote-tracking branch 'origin/Drive-add-command-description-fix' into Drive-add-command-description-fix

James 1 month ago
parent
commit
c70558398b
2 changed files with 9 additions and 6 deletions
  1. 9 4
      Shared.Rcl/CliBootstrap.cs
  2. 0 2
      Tests/EndToEnd/AccessPointE2ETests.cs

+ 9 - 4
Shared.Rcl/CliBootstrap.cs

@@ -63,11 +63,16 @@ public static class CliBootstrap
             ? yamlDir
             : Path.Combine(appBasePath, yamlDir);
         
-        if (!Directory.Exists(resolvedYamlDir))
-            throw new DirectoryNotFoundException(
-                $"YAML directory not found: {resolvedYamlDir}");
-        
+
+        Directory.CreateDirectory(resolvedYamlDir);
+
         var fullYamlPath = Path.Combine(resolvedYamlDir, yamlFile);
+
+        if (!File.Exists(fullYamlPath))
+        {
+            await File.WriteAllTextAsync(fullYamlPath, "");
+        }
+        
         var collection = new YamlResourceCollection(
             fullYamlPath,
             new PhysicalTextFileStore(),

+ 0 - 2
Tests/EndToEnd/AccessPointE2ETests.cs

@@ -27,8 +27,6 @@ public class AccessPointYamlE2ETests(TempYamlCliFixture fs, ITestOutputHelper ou
     [Fact]
     public async Task accesspoints_cli_workflow_test()
     {
-        await File.WriteAllTextAsync(Path.Combine(fs.Root, "config.yaml"), "");
-
         // Add AP
         var (output, yaml) = await ExecuteAsync("accesspoints", "add", "ap01");
         Assert.Equal("Access Point 'ap01' added.\n", output);