3
3
import winreg
4
4
5
5
6
+ def find_vscode ():
7
+ # Check common install paths to find where vsc is installed
8
+ possible_paths = [
9
+ os .path .join (os .getenv ('LOCALAPPDATA' ), 'Programs' , 'Microsoft VS Code' , 'Code.exe' ), # User Installer
10
+ os .path .join (os .getenv ('ProgramFiles' ), 'Microsoft VS Code' , 'Code.exe' ), # System Installer
11
+ os .path .join (os .getenv ('ProgramFiles(x86)' ), 'Microsoft VS Code' , 'Code.exe' ), # 32-bit System Installer
12
+ ]
13
+
14
+ for path in possible_paths :
15
+ if os .path .exists (path ):
16
+ return path
17
+
18
+ # If not found, check registry
19
+ try :
20
+ key = winreg .OpenKey (winreg .HKEY_LOCAL_MACHINE ,
21
+ r"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Code.exe" )
22
+ vscode_path , _ = winreg .QueryValueEx (key , "" )
23
+ return vscode_path
24
+ except FileNotFoundError :
25
+ return None
26
+
27
+
6
28
class Explorer :
7
29
"""
8
30
A class for navigating and interacting with folders in the file system.
@@ -91,7 +113,7 @@ def next():
91
113
if selected_folder is not None :
92
114
Explorer .change_directory (selected_folder , folders )
93
115
94
- def find_vscode ():
116
+ """ def find_vscode():
95
117
# Check common install paths to find where vsc is installed
96
118
possible_paths = [
97
119
os.path.join(os.getenv('LOCALAPPDATA'), 'Programs', 'Microsoft VS Code', 'Code.exe'), # User Installer
@@ -111,6 +133,7 @@ def find_vscode():
111
133
return vscode_path
112
134
except FileNotFoundError:
113
135
return None
136
+ """
114
137
115
138
def vscode ():
116
139
import subprocess , os
0 commit comments