Skip to content

Commit 0cc0fea

Browse files
committed
Fix suggest component name on Windows
Fixes #3127 Signed-off-by: David Thompson <[email protected]>
1 parent 1d65651 commit 0cc0fea

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/webview/create-component/pages/fromLocalCodebase.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export function FromLocalCodebase(props: FromLocalCodebaseProps) {
134134
window.vscodeApi.postMessage({ action: 'getWorkspaceFolders' });
135135
if (props.rootFolder && props.rootFolder.length != 0) {
136136
setProjectFolder(props.rootFolder);
137-
const componentNameFromFolder: string = props.rootFolder.substring(props.rootFolder.lastIndexOf('/') + 1);
137+
const isWindowsPath = props.rootFolder.charAt(1) === ':';
138+
const componentNameFromFolder: string = props.rootFolder.substring(props.rootFolder.lastIndexOf(isWindowsPath ? '\\' : '/') + 1);
138139
setComponentName(componentNameFromFolder);
139140
window.vscodeApi.postMessage({
140141
action: 'validateComponentName',

0 commit comments

Comments
 (0)