diff --git a/public/hackatime/setup.ps1 b/public/hackatime/setup.ps1 index 9d521a0..6cebe48 100644 --- a/public/hackatime/setup.ps1 +++ b/public/hackatime/setup.ps1 @@ -1,7 +1,12 @@ try { # Create config file with API settings $configPath = "$env:USERPROFILE\.wakatime.cfg" - + # If config exists, backup + if (Test-Path $configPath) { + Write-Host "[INFO] Config file already exists, moving into ~/.wakatime.cfg.bak" + Move-Item -Path $configPath -Destination "$configPath.bak" + } + @" [settings] api_url = $env:HACKATIME_API_URL diff --git a/public/hackatime/setup.sh b/public/hackatime/setup.sh index 55c8b1c..9a37edc 100644 --- a/public/hackatime/setup.sh +++ b/public/hackatime/setup.sh @@ -1,6 +1,12 @@ #!/bin/bash set -e +# If config exists, backup +if [ -f ~/.wakatime.cfg ]; then + echo "[INFO] Config file already exists, moving into ~/.wakatime.cfg.bak" + mv ~/.wakatime.cfg ~/.wakatime.cfg.bak +fi + # Create or update config file cat > ~/.wakatime.cfg << EOL [settings] @@ -46,4 +52,4 @@ if [ "$http_code" = "200" ] || [ "$http_code" = "202" ]; then else echo -e "\nError sending heartbeat: $body" exit 1 -fi \ No newline at end of file +fi