Преглед на файлове

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

James преди 1 месец
родител
ревизия
c70558398b
променени са 2 файла, в които са добавени 9 реда и са изтрити 6 реда
  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
             ? yamlDir
             : Path.Combine(appBasePath, 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);
         var fullYamlPath = Path.Combine(resolvedYamlDir, yamlFile);
+
+        if (!File.Exists(fullYamlPath))
+        {
+            await File.WriteAllTextAsync(fullYamlPath, "");
+        }
+        
         var collection = new YamlResourceCollection(
         var collection = new YamlResourceCollection(
             fullYamlPath,
             fullYamlPath,
             new PhysicalTextFileStore(),
             new PhysicalTextFileStore(),

+ 0 - 2
Tests/EndToEnd/AccessPointE2ETests.cs

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