aboutsummaryrefslogtreecommitdiff
path: root/.config/powershell/bootstrap.ps1
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2024-05-30 03:12:50 +0200
committersrdusr <trevorgray@srdusr.com>2024-05-30 03:12:50 +0200
commit0f24e369991a88cd8964ebeb7fb982c5b2f7b08d (patch)
treec46e28116407e1a32aca6d6467915b632db2a5b3 /.config/powershell/bootstrap.ps1
parentd856c6a0256a769886bf10222c33dc3306c346db (diff)
downloaddotfiles-0f24e369991a88cd8964ebeb7fb982c5b2f7b08d.tar.gz
dotfiles-0f24e369991a88cd8964ebeb7fb982c5b2f7b08d.zip
Testing
Diffstat (limited to '.config/powershell/bootstrap.ps1')
-rw-r--r--.config/powershell/bootstrap.ps130
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 {