refactor: Optimize workflow update and command list process
- Introduce copiedDirectory flag to track directory creation - Restructure conditional logic for better flow control - Improve error handling and logging for directory operations
This commit is contained in:
parent
54b49389c5
commit
fd7c2edbbc
@ -216,12 +216,18 @@ export function registerInstallCommandsCommand(
|
||||
const currentVersion = UiUtilWrapper.extensionPath();
|
||||
const previousVersion = devchatConfig.get("last_devchat_version", "");
|
||||
|
||||
let copiedDirectory = false;
|
||||
if (!fs.existsSync(sysMericoDirPath) || (updatePublicWorkflow === false && currentVersion !== previousVersion)) {
|
||||
logger.channel()?.debug("Creating directory: " + sysMericoDirPath);
|
||||
await copyDirectory(pluginDirPath, sysDirPath);
|
||||
copiedDirectory = true;
|
||||
}
|
||||
devchatConfig.set("last_devchat_version", currentVersion);
|
||||
|
||||
if (copiedDirectory) {
|
||||
logger.channel()?.debug("Directory copied successfully.");
|
||||
sendCommandListByDevChatRun();
|
||||
} else {
|
||||
// Check if ~/.chat/scripts directory exists
|
||||
if (!fs.existsSync(sysMericoDirPath)) {
|
||||
// Directory does not exist, wait for updateWorkflows to finish
|
||||
@ -240,6 +246,7 @@ export function registerInstallCommandsCommand(
|
||||
|
||||
await sendCommandListByDevChatRun();
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the panel is activated
|
||||
await ensureChatPanel(context);
|
||||
|
Loading…
x
Reference in New Issue
Block a user