diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-13 08:22:09 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-13 08:22:09 +0800 |
| commit | 5d8b29664c13e6e5c6292d79973980182ece1441 (patch) | |
| tree | ced2f67c82ce0748dbd0090f0fde6b921329d259 /CommandLineWrapper/JVCSWorkspace.cs | |
| parent | 7d59c15b0efd2aa5a27aef356a265f850a2e7e2f (diff) | |
Diffstat (limited to 'CommandLineWrapper/JVCSWorkspace.cs')
| -rw-r--r-- | CommandLineWrapper/JVCSWorkspace.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/CommandLineWrapper/JVCSWorkspace.cs b/CommandLineWrapper/JVCSWorkspace.cs index d88209c..8afd212 100644 --- a/CommandLineWrapper/JVCSWorkspace.cs +++ b/CommandLineWrapper/JVCSWorkspace.cs @@ -1,10 +1,12 @@ -using CommandLineWrapper; +namespace CommandLineWrapper; public class JVCSWorkspace { public string WorkspaceDirectory => _workspaceDirectory ?? Directory.GetCurrentDirectory(); + public bool SuccessInitialized => _successInitialized; private string? _workspaceDirectory; + private bool _successInitialized; public async Task InitializeAsync(string directory) { @@ -17,15 +19,18 @@ public class JVCSWorkspace var currentWorkspace = result.StandardOutput; // Check if the obtained workspace directory is valid (not empty and exists) - if (string.IsNullOrWhiteSpace(currentWorkspace) && + if (!string.IsNullOrWhiteSpace(currentWorkspace) && Directory.Exists(currentWorkspace)) { _workspaceDirectory = currentWorkspace; + _successInitialized = true; } else { // If the workspace is invalid, initialize a new workspace - await JVCSCommandInvoker.Invoke(Constants.CommandParameterGenerator.Initialize()); + result = await JVCSCommandInvoker.Invoke(Constants.CommandParameterGenerator.Initialize(), directory); + if (result.ExitCode == 0) + _successInitialized = true; } } } |
