@@ -7,7 +7,12 @@ set "ORIGINAL_DIR=%CD%"
7
7
:: Change to the directory where the script resides
8
8
cd /d %~dp0
9
9
10
- set " targetPath = %USERPROFILE% \AppData\Roaming\Python\Python312\Scripts"
10
+ if exist " C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2544.0_x64__qbz5n2kfra8p0" (
11
+ set " targetPath = C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2544.0_x64__qbz5n2kfra8p0"
12
+ ) else if exist " %USERPROFILE% \AppData\Roaming\Python\Python312\Scripts" (
13
+ set " targetPath = %USERPROFILE% \\AppData\Roaming\Python\Python312\Scripts"
14
+ )
15
+
11
16
set " found = 0"
12
17
13
18
:: Normalize the target path by removing any trailing backslash
@@ -43,6 +48,8 @@ if "!found!"=="0" (
43
48
44
49
:checkDone
45
50
51
+
52
+ call :ConfigureArgComplete
46
53
call :ConfigureGit
47
54
call :ConfigureVSCode
48
55
call :ConfigurePreCommit
@@ -170,3 +177,33 @@ IF %ERRORLEVEL% NEQ 0 (
170
177
171
178
)
172
179
goto :eof
180
+
181
+ :ConfigureArgComplete
182
+
183
+ :: Define paths
184
+ set " PROFILE_PATH = %USERPROFILE% \Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
185
+ set " MODULE_PATH = C:\Program^ Files^ ^ (x86^ )\ardupilot_methodic_configurator\ardupilot_methodic_configurator_command_line_completion.psm1"
186
+
187
+ :: Create profile directory if it doesn't exist
188
+ if not exist " %USERPROFILE% \Documents\WindowsPowerShell" (
189
+ mkdir " %USERPROFILE% \Documents\WindowsPowerShell"
190
+ )
191
+
192
+ :: Check if module exists
193
+ if not exist " %MODULE_PATH% " (
194
+ echo Error: Module file not found at %MODULE_PATH%
195
+ pause
196
+ exit /b 1
197
+ )
198
+
199
+ :: Add import line to profile if it doesn't exist
200
+ powershell -Command " if (-not (Test-Path '%PROFILE_PATH% ')) { New-Item -Path '%PROFILE_PATH% ' -Force } else { $content = Get-Content '%PROFILE_PATH% '; if ($content -notcontains 'Import-Module \" %MODULE_PATH% \" ') { Add-Content '%PROFILE_PATH% ' 'Import-Module \" %MODULE_PATH% \" ' }}"
201
+
202
+ if %errorLevel% equ 0 (
203
+ echo PowerShell profile updated successfully.
204
+ echo Please restart PowerShell for changes to take effect.
205
+ ) else (
206
+ echo Failed to update PowerShell profile.
207
+ )
208
+
209
+ goto :eof
0 commit comments