Skip to content

Commit a01fb96

Browse files
committed
fix: prevent opening system default app when only shared config exists
When a file has no specific extension config but has __ALL__ shared config, the system default app should not be opened. This fixes the issue where both the system default app and the configured app in shared config were opened. Fixes #69
1 parent 1b9936d commit a01fb96

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/openInExternalApp.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,19 @@ export default async function openInExternalApp(
122122
matchedConfigItem = getConfigItemById(configuration, configItemId);
123123
}
124124

125+
const sharedConfigItem = getSharedConfigItem(configuration);
126+
125127
if (matchedConfigItem) {
126128
logger.info('found matched config');
127129
await openWithConfigItem(filePath, matchedConfigItem, isMultiple);
128-
} else {
129-
logger.info('no matched config');
130+
} else if (!sharedConfigItem) {
131+
// Only use system default when there's no matched config and no shared config
132+
logger.info('no matched config and no shared config');
130133
await open(filePath);
134+
} else {
135+
logger.info('no matched config, but found shared config');
131136
}
132137

133-
const sharedConfigItem = getSharedConfigItem(configuration);
134138
if (sharedConfigItem) {
135139
logger.info('found shared config');
136140
await openWithConfigItem(filePath, sharedConfigItem, false);

0 commit comments

Comments
 (0)