diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-05-30 03:12:50 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-05-30 03:12:50 +0200 |
| commit | 0f24e369991a88cd8964ebeb7fb982c5b2f7b08d (patch) | |
| tree | c46e28116407e1a32aca6d6467915b632db2a5b3 | |
| parent | d856c6a0256a769886bf10222c33dc3306c346db (diff) | |
| download | dotfiles-0f24e369991a88cd8964ebeb7fb982c5b2f7b08d.tar.gz dotfiles-0f24e369991a88cd8964ebeb7fb982c5b2f7b08d.zip | |
Testing
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 51357b5..e2adcdf 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -271,18 +271,20 @@ $PowerShellProfileTemplate = "$PSScriptRoot\$USERNAME\Documents\PowerShell\Micro # Remove OneDrive directory Write-Host "Removing OneDrive directory" -Remove-Item "$env:USERPROFILE\OneDrive" -Recurse -Force +#Remove-Item "$env:USERPROFILE\OneDrive" -Recurse -Force +cd $HOME && rm OneDrive -r -force # Configure PowerShell Write-Host "Configuring PowerShell" Write-Host "----------------------------------------" -$documentsPath = [Environment]::GetFolderPath('Personal') # Default Documents folder -if ($documentsPath -like "*OneDrive*") { - $documentsPath = "$env:USERPROFILE\Documents" -} +# Set documents path to user's local Documents folder +$documentsPath = "$env:USERPROFILE\Documents" $powerShellProfileDir = "$documentsPath\PowerShell" +# Output the chosen PowerShell profile directory +Write-Host "PowerShell profile directory set to: $powerShellProfileDir" + if (-not (Test-Path -Path $powerShellProfileDir)) { New-Item -ItemType Directory -Path $powerShellProfileDir -Force } @@ -297,10 +299,10 @@ New-Item -ItemType HardLink -Force ` #Write-Host "PowerShell profile directory set to: $powerShellProfileDir" #Write-Host "Environment variable 'PowerShellProfileDir' set to: $powerShellProfileDir" -# Verify profile sourcing -if (!(Test-Path -Path "$home\.config\powershell\Microsoft.PowerShell_profile.ps1")) { - handle_error "PowerShell profile does not exist. Please create it at $home\.config\powershell\Microsoft.PowerShell_profile.ps1" -} +## Verify profile sourcing +#if (!(Test-Path -Path "$home\.config\powershell\Microsoft.PowerShell_profile.ps1")) { +# handle_error "PowerShell profile does not exist. Please create it at $home\.config\powershell\Microsoft.PowerShell_profile.ps1" +#} # Define the `config` alias in the current session function global:config { @@ -312,17 +314,17 @@ Add-Content -Path "$HOME\.gitignore" -Value ".cfg" Add-Content -Path "$HOME\.gitignore" -Value "install.bat" Add-Content -Path "$HOME\.gitignore" -Value ".config/powershell/bootstrap.ps1" -# Check if the profile exists, otherwise create it -if (!(Test-Path -Path $PROFILE)) { - New-Item -Type File -Path $PROFILE -Force -} +## Check if the profile exists, otherwise create it +#if (!(Test-Path -Path $PROFILE)) { +# New-Item -Type File -Path $PROFILE -Force +#} Add-Content -Path $PROFILE -Value "`nfunction config { git --git-dir=`$env:USERPROFILE/.cfg/ --work-tree=`$env:USERPROFILE @args }" Add-Content -Path $PROFILE -Value "`n. $PROFILE" # Source the profile immediately to make the alias available . $PROFILE -echo '. "$HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"' >> $PROFILE +#echo '. "$HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"' >> $PROFILE # Function to install dotfiles function install_dotfiles { |
