feat: Windows development tooling — build, install, uninstall scripts + setup guide
- build-windows.ps1: one-command Flutter build + Inno Setup installer pipeline - install.ps1: manual Windows installer (registry, shortcuts, file associations) - uninstall.ps1: clean removal script - docs/windows-setup.md: Windows dev environment setup guide - docs/index.md: updated with new files
This commit is contained in:
165
build-windows.ps1
Normal file
165
build-windows.ps1
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
ImajViewer Windows Build & Installer Pipeline
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Tek komutla Flutter Windows build + Inno Setup installer olusturur.
|
||||||
|
Sirali olarak:
|
||||||
|
1. flutter pub get
|
||||||
|
2. flutter build windows --release
|
||||||
|
3. Inno Setup ile .exe installer olusturma
|
||||||
|
|
||||||
|
.PARAMETER Configuration
|
||||||
|
Build konfigurasyonu: 'Release' (varsayilan) veya 'Debug'
|
||||||
|
|
||||||
|
.PARAMETER SkipInno
|
||||||
|
Inno Setup adimini atlar (sadece Flutter build yapar)
|
||||||
|
|
||||||
|
.PARAMETER Clean
|
||||||
|
Build oncesi 'flutter clean' calistirir
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\build-windows.ps1
|
||||||
|
.\build-windows.ps1 -Configuration Debug
|
||||||
|
.\build-windows.ps1 -SkipInno
|
||||||
|
.\build-windows.ps1 -Clean -Configuration Release
|
||||||
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[ValidateSet('Release', 'Debug')]
|
||||||
|
[string]$Configuration = 'Release',
|
||||||
|
|
||||||
|
[switch]$SkipInno,
|
||||||
|
[switch]$Clean
|
||||||
|
)
|
||||||
|
|
||||||
|
# Renkli cikti
|
||||||
|
function Write-Step { param([string]$Msg) Write-Host "`n>> $Msg" -ForegroundColor Cyan }
|
||||||
|
function Write-Ok { param([string]$Msg) Write-Host " [OK] $Msg" -ForegroundColor Green }
|
||||||
|
function Write-Err { param([string]$Msg) Write-Host " [X] $Msg" -ForegroundColor Red; exit 1 }
|
||||||
|
function Write-Warn { param([string]$Msg) Write-Host " [!] $Msg" -ForegroundColor Yellow }
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " ImajViewer Windows Build Pipeline" -ForegroundColor White
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " Configuration : $Configuration" -ForegroundColor Gray
|
||||||
|
Write-Host " Project Root : $ProjectRoot" -ForegroundColor Gray
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
Set-Location $ProjectRoot
|
||||||
|
|
||||||
|
# ── On kosullar ──────────────────────────────────────────────
|
||||||
|
Write-Step "On kosullar kontrol ediliyor..."
|
||||||
|
|
||||||
|
# Flutter
|
||||||
|
if (-not (Get-Command flutter -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-Err "Flutter SDK bulunamadi. PATH'e ekleyin veya https://docs.flutter.dev/get-started/install/windows adresinden kurun."
|
||||||
|
}
|
||||||
|
Write-Ok "Flutter: $(flutter --version 2>&1 | Select-String 'Flutter' | Select-Object -First 1)"
|
||||||
|
|
||||||
|
# Visual Studio / MSVC
|
||||||
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
|
if (Test-Path $vswhere) {
|
||||||
|
$vsInstall = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 2>$null
|
||||||
|
if ($vsInstall) {
|
||||||
|
Write-Ok "Visual Studio C++ tools bulundu: $vsInstall"
|
||||||
|
} else {
|
||||||
|
Write-Warn "Visual Studio C++ tools bulunamadi. 'Desktop development with C++' workload'unu kurun."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Warn "vswhere bulunamadi. Visual Studio Build Tools kurulu olabilir mi kontrol edin."
|
||||||
|
}
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
if (Get-Command cmake -ErrorAction SilentlyContinue) {
|
||||||
|
Write-Ok "CMake: $(cmake --version 2>&1 | Select-Object -First 1)"
|
||||||
|
} else {
|
||||||
|
Write-Warn "CMake PATH'te bulunamadi. Flutter icin genelde gerekli degildir."
|
||||||
|
}
|
||||||
|
|
||||||
|
# Inno Setup
|
||||||
|
if (-not $SkipInno) {
|
||||||
|
$isccPaths = @(
|
||||||
|
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
|
||||||
|
"C:\Program Files\Inno Setup 6\ISCC.exe",
|
||||||
|
"C:\Users\$env:USERNAME\AppData\Local\Programs\Inno Setup 6\ISCC.exe"
|
||||||
|
)
|
||||||
|
$iscc = $isccPaths | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||||
|
if ($iscc) {
|
||||||
|
Write-Ok "Inno Setup: $iscc"
|
||||||
|
} else {
|
||||||
|
Write-Err "Inno Setup 6 bulunamadi. http://www.jrsoftware.org/isdl.php adresinden kurun."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Adim 1: flutter clean (opsiyonel) ──────────────────────
|
||||||
|
if ($Clean) {
|
||||||
|
Write-Step "Adim 1/3: flutter clean"
|
||||||
|
flutter clean 2>&1 | Out-Null
|
||||||
|
Write-Ok "Clean tamamlandi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Adim 2: flutter pub get ────────────────────────────────
|
||||||
|
Write-Step "Adim 2/3: flutter pub get"
|
||||||
|
$result = flutter pub get 2>&1
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host $result -ForegroundColor Red
|
||||||
|
Write-Err "flutter pub get basarisiz!"
|
||||||
|
}
|
||||||
|
Write-Ok "Bağımlilikler indirildi"
|
||||||
|
|
||||||
|
# ── Adim 3: flutter build windows ──────────────────────────
|
||||||
|
Write-Step "Adim 3/3: flutter build windows --$Configuration"
|
||||||
|
$buildArgs = @('build', 'windows', "--$Configuration")
|
||||||
|
$result = flutter @buildArgs 2>&1
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host $result -ForegroundColor Red
|
||||||
|
Write-Err "Flutter build basarisiz! flutter doctor ile sorunlari kontrol edin."
|
||||||
|
}
|
||||||
|
|
||||||
|
$buildOutput = Join-Path $ProjectRoot "build\windows\x64\runner\$Configuration"
|
||||||
|
if (-not (Test-Path (Join-Path $buildOutput "imajviewer.exe"))) {
|
||||||
|
Write-Err "Build cikti dosyasi bulunamadi: $buildOutput\imajviewer.exe"
|
||||||
|
}
|
||||||
|
Write-Ok "Build tamamlandi: $buildOutput"
|
||||||
|
|
||||||
|
# ── Adim 4: Inno Setup (opsiyonel) ────────────────────────
|
||||||
|
if (-not $SkipInno) {
|
||||||
|
Write-Step "Inno Setup ile installer olusturuluyor..."
|
||||||
|
|
||||||
|
$installerScript = Join-Path $ProjectRoot "windows\installer.iss"
|
||||||
|
if (-not (Test-Path $installerScript)) {
|
||||||
|
Write-Err "Installer scripti bulunamadi: $installerScript"
|
||||||
|
}
|
||||||
|
|
||||||
|
$distDir = Join-Path $ProjectRoot "dist"
|
||||||
|
New-Item -ItemType Directory -Force -Path $distDir | Out-Null
|
||||||
|
|
||||||
|
& $iscc $installerScript 2>&1
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Err "Inno Setup derleme basarisiz!"
|
||||||
|
}
|
||||||
|
|
||||||
|
$setupExe = Get-ChildItem -Path $distDir -Filter "imajviewer_setup_*.exe" | Select-Object -First 1
|
||||||
|
if ($setupExe) {
|
||||||
|
$sizeMB = [math]::Round($setupExe.Length / 1MB, 2)
|
||||||
|
Write-Ok "Installer olusturuldu: $($setupExe.FullName) ($sizeMB MB)"
|
||||||
|
} else {
|
||||||
|
Write-Warn "Installer dosyasi dist/ dizininde bulunamadi."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Tamamlandı ──────────────────────────────────────────────
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host " Build tamamlandi!" -ForegroundColor Green
|
||||||
|
Write-Host " Cikti: $buildOutput" -ForegroundColor Green
|
||||||
|
if (-not $SkipInno) {
|
||||||
|
Write-Host " Installer: dist\imajviewer_setup_*.exe" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
@@ -19,10 +19,21 @@
|
|||||||
| 2026-07-27 | [session-windows-ci.md](session-windows-ci.md) | **Windows setup.exe yeniden derlendi, Gitea CI eklendi** |
|
| 2026-07-27 | [session-windows-ci.md](session-windows-ci.md) | **Windows setup.exe yeniden derlendi, Gitea CI eklendi** |
|
||||||
| 2026-07-27 | [session-2026-07-27.md](session-2026-07-27.md) | **Session özeti** — rotate aktif, StartupWMClass ile taskbar gruplama |
|
| 2026-07-27 | [session-2026-07-27.md](session-2026-07-27.md) | **Session özeti** — rotate aktif, StartupWMClass ile taskbar gruplama |
|
||||||
| 2026-07-27 | [image-canvas-interactions.md](image-canvas-interactions.md) | Detaylı analiz: contrast, saturation, rotate implementasyon planı |
|
| 2026-07-27 | [image-canvas-interactions.md](image-canvas-interactions.md) | Detaylı analiz: contrast, saturation, rotate implementasyon planı |
|
||||||
|
| 2026-08-10 | [windows-setup.md](windows-setup.md) | **Windows Development Ortam Kurulum Rehberi** — Flutter SDK, VS Build Tools, CMake, Inno Setup kurulum adımları |
|
||||||
| önceki | [zoom-clamp-mekanizmasi.md](zoom-clamp-mekanizmasi.md) | Zoom clamp mekanizması (letterbox-aware) |
|
| önceki | [zoom-clamp-mekanizmasi.md](zoom-clamp-mekanizmasi.md) | Zoom clamp mekanizması (letterbox-aware) |
|
||||||
|
|
||||||
## Geliştirme Akışı — Otomatik Build ve Kurulum
|
## Geliştirme Akışı — Otomatik Build ve Kurulum
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
1. Debug build: `flutter build linux --debug`
|
||||||
|
2. Sisteme kurulum: `./install.sh` (debug bundle tercih edilir → `~/.local/lib/imajviewer/`)
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
1. Ortam kurulumu: [windows-setup.md](windows-setup.md) rehberini takip edin
|
||||||
|
2. Build + installer: `.\build-windows.ps1`
|
||||||
|
3. Manuel kurulum (build çıktılarından): `.\install.ps1`
|
||||||
|
4. Kaldırma: `.\uninstall.ps1`
|
||||||
|
|
||||||
Projede değişiklik yapıldıktan sonra otomatik yapılır (ayrıca istenmez):
|
Projede değişiklik yapıldıktan sonra otomatik yapılır (ayrıca istenmez):
|
||||||
1. Debug build: `flutter build linux --debug`
|
1. Debug build: `flutter build linux --debug`
|
||||||
2. Sisteme kurulum: `./install.sh` (debug bundle tercih edilir → `~/.local/lib/imajviewer/`)
|
2. Sisteme kurulum: `./install.sh` (debug bundle tercih edilir → `~/.local/lib/imajviewer/`)
|
||||||
|
|||||||
217
docs/windows-setup.md
Normal file
217
docs/windows-setup.md
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
# Windows Development Ortam Kurulum Rehberi
|
||||||
|
|
||||||
|
Bu doküman, ImajViewer Flutter projesini Windows üzerinde geliştirmek için gerekli ortamın sıfırdan kurulmasını adım adım anlatır.
|
||||||
|
|
||||||
|
## Gereksinimler
|
||||||
|
|
||||||
|
| Araç | Minimum Versiyon | Açıklama |
|
||||||
|
|------|-----------------|----------|
|
||||||
|
| Flutter SDK | 3.27+ (stable) | UI framework |
|
||||||
|
| Visual Studio 2022 | Build Tools veya Community | C++ derleyici (MSVC) |
|
||||||
|
| CMake | 3.14+ | Build sistemi |
|
||||||
|
| Inno Setup | 6.x | Windows installer (.exe) oluşturma |
|
||||||
|
|
||||||
|
## Adım 1: Flutter SDK Kurulumu
|
||||||
|
|
||||||
|
### Yöntem A: Resmi kurulum (Önerilen)
|
||||||
|
|
||||||
|
1. [Flutter SDK'yı indirin](https://docs.flutter.dev/get-started/install/windows)
|
||||||
|
2. ZIP'i `C:\src\flutter` dizinine çıkarın
|
||||||
|
3. PATH'e ekleyin:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# PowerShell (Admin)
|
||||||
|
[Environment]::SetEnvironmentVariable(
|
||||||
|
"PATH",
|
||||||
|
"$([Environment]::GetEnvironmentVariable("PATH", "Machine"))\;C:\src\flutter\bin",
|
||||||
|
"Machine"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Yeni terminalde doğrulayın:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
### Yöntem B: Winget ile kurulum
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
winget install --id OpenFlutter.FlutterSDK
|
||||||
|
```
|
||||||
|
|
||||||
|
### Flutter doctor kontrolleri
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter doctor
|
||||||
|
```
|
||||||
|
|
||||||
|
Çıktıda `[✗]` işaretli bileşenler için önerilen adımları uygulayın. En azından şunlar `✓` olmalı:
|
||||||
|
|
||||||
|
- Flutter
|
||||||
|
- Android toolchain (opsiyonel, sadece mobile geliştirme için)
|
||||||
|
- Visual Studio (eğer kuruluysa)
|
||||||
|
- Connected device (Windows)
|
||||||
|
|
||||||
|
## Adım 2: Visual Studio 2022 Build Tools Kurulumu
|
||||||
|
|
||||||
|
Flutter Windows build'i için MSVC C++ derleyicisi gerekir.
|
||||||
|
|
||||||
|
### Seçenek A: Visual Studio Build Tools (Sadece build araçları)
|
||||||
|
|
||||||
|
1. [Visual Studio Build Tools 2022](https://visualstudio.microsoft.com/visual-cpp-build-tools/) indirin
|
||||||
|
2. Kurulum sihirbazında **"Desktop development with C++"** workload'unu işaretleyin
|
||||||
|
3. Aşağıdaki bileşenler otomatik seçilecektir:
|
||||||
|
- MSVC v143 - VS 2022 C++ x64/x86 build tools
|
||||||
|
- Windows 10/11 SDK
|
||||||
|
- CMake tools (opsiyonel ama önerilir)
|
||||||
|
|
||||||
|
### Seçenek B: Visual Studio Community (Tam IDE)
|
||||||
|
|
||||||
|
1. [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community/) indirin
|
||||||
|
2. Kurulumda **"Desktop development with C++"** workload'unu seçin
|
||||||
|
|
||||||
|
### Doğrulama
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
cl
|
||||||
|
```
|
||||||
|
|
||||||
|
Çıktıda `Microsoft (R) C/C++ Optimizing Compiler` görünmelidir.
|
||||||
|
|
||||||
|
## Adım 3: CMake Kurulumu
|
||||||
|
|
||||||
|
Visual Studio Build Tools ile birlikte gelir ancak bağımsız kurulum da yapılabilir.
|
||||||
|
|
||||||
|
### Winget ile:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
winget install --id Kitware.CMake
|
||||||
|
```
|
||||||
|
|
||||||
|
### Doğrulama:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
cmake --version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adım 4: Inno Setup 6 Kurulumu
|
||||||
|
|
||||||
|
Windows installer (.exe) oluşturmak için gereklidir.
|
||||||
|
|
||||||
|
1. [Inno Setup 6](http://www.jrsoftware.org/isdl.php#stable) indirin (`is.exe`)
|
||||||
|
2. Kurulumu tamamlayın (varsayılan: `C:\Program Files (x86)\Inno Setup 6`)
|
||||||
|
|
||||||
|
### Doğrulama:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Test-Path "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adım 5: Projeyi Hazırlama
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
cd C:\projects\imajviewer
|
||||||
|
|
||||||
|
# Bağımlılıkları indir
|
||||||
|
flutter pub get
|
||||||
|
|
||||||
|
# Analiz et
|
||||||
|
flutter analyze
|
||||||
|
|
||||||
|
# Test çalıştır
|
||||||
|
flutter test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adım 6: Windows Build
|
||||||
|
|
||||||
|
### Debug build:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter build windows --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
Çıktı: `build\windows\x64\runner\Debug\`
|
||||||
|
|
||||||
|
### Release build:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter build windows --release
|
||||||
|
```
|
||||||
|
|
||||||
|
Çıktı: `build\windows\x64\runner\Release\`
|
||||||
|
|
||||||
|
## Adım 7: Installer Oluşturma (Inno Setup)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Release build yapıldıktan sonra
|
||||||
|
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" windows\installer.iss
|
||||||
|
```
|
||||||
|
|
||||||
|
Çıktı: `dist\imajviewer_setup_1.1.0.exe`
|
||||||
|
|
||||||
|
## Tek Komutla Her Şey
|
||||||
|
|
||||||
|
Tüm build + installer pipeline'ını tek komutla çalıştırın:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
.\build-windows.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
Bu script:
|
||||||
|
1. `flutter pub get`
|
||||||
|
2. `flutter build windows --release`
|
||||||
|
3. Inno Setup ile `.exe` installer oluşturur
|
||||||
|
|
||||||
|
## Sorun Giderme
|
||||||
|
|
||||||
|
### "Unable to find Visual Studio installation" hatası
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
flutter config --enable-windows-desktop
|
||||||
|
```
|
||||||
|
|
||||||
|
Visual Studio 2022'nin doğru kurulduğunu `flutter doctor` ile kontrol edin.
|
||||||
|
|
||||||
|
### CMake hataları
|
||||||
|
|
||||||
|
CMake'in PATH'te olduğundan emin olun:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:PATH += ";C:\Program Files\CMake\bin"
|
||||||
|
cmake --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### Inno Setup bulunamadı
|
||||||
|
|
||||||
|
`build-windows.ps1` script'i otomatik arar. Manuel çalıştırmak için:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" windows\installer.iss
|
||||||
|
```
|
||||||
|
|
||||||
|
### Flutter doctor'da Android SDK uyarısı
|
||||||
|
|
||||||
|
Sadece desktop geliştirme yapıyorsanız bu uyarıları görmezden gelebilirsiniz.
|
||||||
|
|
||||||
|
## Kurulum Sonrası
|
||||||
|
|
||||||
|
Ortam hazır olduğunda:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Build + installer
|
||||||
|
.\build-windows.ps1
|
||||||
|
|
||||||
|
# Manuel kurulum (build çıktılarından)
|
||||||
|
.\install.ps1
|
||||||
|
|
||||||
|
# Uninstall
|
||||||
|
.\uninstall.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sistem Gereksinimleri (Minimum)
|
||||||
|
|
||||||
|
- Windows 10 (1809) veya üzeri
|
||||||
|
- 4 GB RAM (8 GB önerilir)
|
||||||
|
- ~4 GB disk alanı (Flutter SDK + VS Build Tools + proje)
|
||||||
|
- x64 mimari
|
||||||
224
install.ps1
Normal file
224
install.ps1
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
ImajViewer Windows kurulum scripti
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Flutter build ciktilarini alip Windows sisteme kurar.
|
||||||
|
Linux install.sh'nin Windows karsiligidir.
|
||||||
|
|
||||||
|
Islevleri:
|
||||||
|
- Binary + DLL'leri hedef dizine kopyalar
|
||||||
|
- Registry'de dosya association'larini kaydeder (PNG, JPG, JPEG, WebP, BMP, GIF)
|
||||||
|
- Start Menu kisayolu olusturur
|
||||||
|
- Masamustu kisayolu olusturur (isteğe bagli)
|
||||||
|
- Uninstall girdisi olusturur
|
||||||
|
|
||||||
|
.PARAMETER InstallDir
|
||||||
|
Kurulum dizini (varsayilan: %ProgramFiles%\ImajViewer)
|
||||||
|
|
||||||
|
.PARAMETER AddDesktopIcon
|
||||||
|
Masamustu kisayolu olusturur
|
||||||
|
|
||||||
|
.PARAMETER RegisterAsDefault
|
||||||
|
ImajViewer'yi varsayilan goruntu goruntuleyici yapar
|
||||||
|
|
||||||
|
.PARAMETER CurrentUser
|
||||||
|
Sadece guncel kullanici icin kur (admin hakki gerekmez, %LOCALAPPDATA% kullanilir)
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\install.ps1
|
||||||
|
.\install.ps1 -InstallDir "C:\Apps\ImajViewer" -AddDesktopIcon
|
||||||
|
.\install.ps1 -CurrentUser -RegisterAsDefault
|
||||||
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$InstallDir = "",
|
||||||
|
[switch]$AddDesktopIcon,
|
||||||
|
[switch]$RegisterAsDefault,
|
||||||
|
[switch]$CurrentUser
|
||||||
|
)
|
||||||
|
|
||||||
|
# Renkli cikti
|
||||||
|
function Write-Step { param([string]$Msg) Write-Host "`n> $Msg" -ForegroundColor Cyan }
|
||||||
|
function Write-Ok { param([string]$Msg) Write-Host " [OK] $Msg" -ForegroundColor Green }
|
||||||
|
function Write-Err { param([string]$Msg) Write-Host " [X] $Msg" -ForegroundColor Red; exit 1 }
|
||||||
|
function Write-Warn { param([string]$Msg) Write-Host " [!] $Msg" -ForegroundColor Yellow }
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$AppName = "ImajViewer"
|
||||||
|
$AppExe = "imajviewer.exe"
|
||||||
|
$AppVersion = "1.1.0"
|
||||||
|
$UninstallGuid = "B8F4A3D2-1C5E-4A7B-9D0F-6E2C8A1B3D5F"
|
||||||
|
|
||||||
|
# ── Kurulum dizini belirleme ─────────────────────────────
|
||||||
|
if (-not $InstallDir) {
|
||||||
|
if ($CurrentUser) {
|
||||||
|
$InstallDir = Join-Path $env:LOCALAPPDATA $AppName
|
||||||
|
} else {
|
||||||
|
$InstallDir = Join-Path ${env:ProgramFiles(x86)} $AppName
|
||||||
|
if (-not (Test-Path ${env:ProgramFiles(x86)})) {
|
||||||
|
$InstallDir = Join-Path $env:ProgramFiles $AppName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Build cikti dizini bul ───────────────────────────────
|
||||||
|
$buildPaths = @(
|
||||||
|
Join-Path $ProjectRoot "build\windows\x64\runner\Release",
|
||||||
|
Join-Path $ProjectRoot "build\windows\x64\runner\Debug"
|
||||||
|
)
|
||||||
|
$BuildDir = $buildPaths | Where-Object { Test-Path (Join-Path $_ $AppExe) } | Select-Object -First 1
|
||||||
|
|
||||||
|
if (-not $BuildDir) {
|
||||||
|
Write-Err "Build cikti bulunamadi! Once 'flutter build windows --release' calistirin veya build-windows.ps1 kullanin."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " ImajViewer Windows Kurulum" -ForegroundColor White
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " Build Dir : $BuildDir" -ForegroundColor Gray
|
||||||
|
Write-Host " Install Dir : $InstallDir" -ForegroundColor Gray
|
||||||
|
Write-Host " CurrentUser : $CurrentUser" -ForegroundColor Gray
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# ── Admin kontrolu (CurrentUser degilse) ──────────────────
|
||||||
|
if (-not $CurrentUser) {
|
||||||
|
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||||
|
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
|
||||||
|
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
|
Write-Err "Bu kurulum admin hakki gerektiriyor. `n`n 1. PowerShell'i 'Yonetici olarak calistir' modunda acin, veya`n 2. '-CurrentUser' parametresi ile kullanici bazli kurun.`n`n .\install.ps1 -CurrentUser"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Hedef dizin olustur ──────────────────────────────────
|
||||||
|
Write-Step "Kurulum dizini hazirlaniyor..."
|
||||||
|
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
|
||||||
|
Write-Ok "Dizin: $InstallDir"
|
||||||
|
|
||||||
|
# ── Dosyalari kopyala ─────────────────────────────────────
|
||||||
|
Write-Step "Dosyalar kopyalaniyor..."
|
||||||
|
Copy-Item -Path (Join-Path $BuildDir "*") -Destination $InstallDir -Recurse -Force
|
||||||
|
Write-Ok "Dosyalar kopyalandi"
|
||||||
|
|
||||||
|
# Exe dosyasini kontrol et
|
||||||
|
$installedExe = Join-Path $InstallDir $AppExe
|
||||||
|
if (-not (Test-Path $installedExe)) {
|
||||||
|
Write-Err "$AppExe kurulum dizininde bulunamadi!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Registry: Uninstall girdisi ──────────────────────────
|
||||||
|
Write-Step "Uninstall girdisi olusturuluyor..."
|
||||||
|
|
||||||
|
if ($CurrentUser) {
|
||||||
|
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid"
|
||||||
|
} else {
|
||||||
|
$regPath = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid"
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -Path $regPath -Force | Out-Null
|
||||||
|
Set-ItemProperty -Path $regPath -Name "DisplayName" -Value $AppName
|
||||||
|
Set-ItemProperty -Path $regPath -Name "DisplayVersion" -Value $AppVersion
|
||||||
|
Set-ItemProperty -Path $regPath -Name "Publisher" -Value "imajviewer"
|
||||||
|
Set-ItemProperty -Path $regPath -Name "InstallLocation" -Value $InstallDir
|
||||||
|
Set-ItemProperty -Path $regPath -Name "UninstallString" -Value "`"$PSScriptRoot\uninstall.ps1`" --install-dir `"$InstallDir`""
|
||||||
|
Set-ItemProperty -Path $regPath -Name "DisplayIcon" -Value "$installedExe,0"
|
||||||
|
Set-ItemProperty -Path $regPath -Name "EstimatedSize" -Value (
|
||||||
|
(Get-ChildItem -Path $InstallDir -Recurse | Measure-Object -Property Length -Sum).Sum / 1KB
|
||||||
|
) -Type DWord
|
||||||
|
Write-Ok "Registry: $regPath"
|
||||||
|
|
||||||
|
# ── Start Menu kisayolu ──────────────────────────────────
|
||||||
|
Write-Step "Start Menu kisayolu olusturuluyor..."
|
||||||
|
|
||||||
|
if ($CurrentUser) {
|
||||||
|
$startMenu = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs"
|
||||||
|
} else {
|
||||||
|
$startMenu = [Environment]::GetFolderPath("CommonPrograms")
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path $startMenu | Out-Null
|
||||||
|
$shortcutPath = Join-Path $startMenu "$AppName.lnk"
|
||||||
|
|
||||||
|
$WshShell = New-Object -ComObject WScript.Shell
|
||||||
|
$shortcut = $WshShell.CreateShortcut($shortcutPath)
|
||||||
|
$shortcut.TargetPath = $installedExe
|
||||||
|
$shortcut.WorkingDirectory = $InstallDir
|
||||||
|
$shortcut.Description = "Ultra hafif goruntu goruntuleyici"
|
||||||
|
$shortcut.Save()
|
||||||
|
Write-Ok "Start Menu: $shortcutPath"
|
||||||
|
|
||||||
|
# ── Masaustu kisayolu (isteğe bagli) ─────────────────────
|
||||||
|
if ($AddDesktopIcon) {
|
||||||
|
Write-Step "Masaustu kisayolu olusturuluyor..."
|
||||||
|
$desktop = [Environment]::GetFolderPath("Desktop")
|
||||||
|
$desktopShortcut = Join-Path $desktop "$AppName.lnk"
|
||||||
|
|
||||||
|
$shortcut2 = $WshShell.CreateShortcut($desktopShortcut)
|
||||||
|
$shortcut2.TargetPath = $installedExe
|
||||||
|
$shortcut2.WorkingDirectory = $InstallDir
|
||||||
|
$shortcut2.Description = "Ultra hafif goruntu goruntuleyici"
|
||||||
|
$shortcut2.Save()
|
||||||
|
Write-Ok "Masaustu: $desktopShortcut"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Dosya association'lar ────────────────────────────────
|
||||||
|
$imageExtensions = @(".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif")
|
||||||
|
$mimeTypes = @(
|
||||||
|
"image/png", "image/jpeg", "image/jpg",
|
||||||
|
"image/webp", "image/bmp", "image/gif"
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Step "Dosya association'lar kaydediliyor..."
|
||||||
|
|
||||||
|
# Applications\imajviewer.exe\shell\open\command
|
||||||
|
$appRegKey = "HKCU:\Software\Classes\Applications\$AppExe\shell\open\command"
|
||||||
|
New-Item -Path $appRegKey -Force | Out-Null
|
||||||
|
Set-ItemProperty -Path $appRegKey -Name "" -Value "`"$installedExe`" `"%1`""
|
||||||
|
Write-Ok "Applications registry girdisi olusturuldu"
|
||||||
|
|
||||||
|
# Her dosya uzantisi icin OpenWithProgids
|
||||||
|
foreach ($ext in $imageExtensions) {
|
||||||
|
$extKey = "HKCU:\Software\Classes\$ext\OpenWithProgids"
|
||||||
|
if (-not (Test-Path $extKey)) {
|
||||||
|
New-Item -Path $extKey -Force | Out-Null
|
||||||
|
}
|
||||||
|
# ImajViewer progid'sini ekle (bozukluk yaratmamak icin mevcut degeri koru)
|
||||||
|
$existing = Get-ItemProperty -Path $extKey -ErrorAction SilentlyContinue
|
||||||
|
$progidName = "ImajViewer"
|
||||||
|
$existing | Add-Member -MemberType NoteProperty -Name $progidName -Value "" -Force | Out-Null
|
||||||
|
Set-ItemProperty -Path $extKey -Name $progidName -Value ""
|
||||||
|
Write-Ok "$ext association eklendi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Varsayilan goruntu goruntuleyici (isteğe bagli) ──────
|
||||||
|
if ($RegisterAsDefault) {
|
||||||
|
Write-Step "Varsayilan goruntu goruntuleyici olarak ayarlaniyor..."
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Windows 10/11: SetAsAssociationManager veya Set-ItemProperty ile
|
||||||
|
foreach ($ext in $imageExtensions) {
|
||||||
|
$userChoiceKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\UserChoice"
|
||||||
|
if (Test-Path $userChoiceKey) {
|
||||||
|
Set-ItemProperty -Path $userChoiceKey -Name "ProgId" -Value "Applications\$AppExe"
|
||||||
|
Write-Ok "$ext varsayilan olarak $AppName ayarlandi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Warn "Varsayilan degisitirme basarisiz (kullanici arayuzu uzerinden degerlendirebilirsiniz): $_"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Tamamlandı ────────────────────────────────────────────
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host " $AppName kuruldu!" -ForegroundColor Green
|
||||||
|
Write-Host "" -ForegroundColor Green
|
||||||
|
Write-Host " Kurulum dizini : $InstallDir" -ForegroundColor Green
|
||||||
|
Write-Host " Gorsel dosyalara sag tik > 'Birlikte ac' > $AppName" -ForegroundColor Green
|
||||||
|
Write-Host "" -ForegroundColor Green
|
||||||
|
Write-Host " Kaldirmak icin : .\uninstall.ps1" -ForegroundColor Green
|
||||||
|
Write-Host " veya Ayarlar > Uygulamalar > $AppName" -ForegroundColor Green
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
158
uninstall.ps1
Normal file
158
uninstall.ps1
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
#Requires -Version 5.1
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
ImajViewer Windows kaldirma scripti
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
ImajViewer'i Windows sistemden tamamen kaldirir:
|
||||||
|
- Kurulum dizinini siler
|
||||||
|
- Registry'den uninstall girdisini siler
|
||||||
|
- Start Menu kisayolu silinir
|
||||||
|
- Dosya association'lar temizlenir
|
||||||
|
|
||||||
|
.PARAMETER InstallDir
|
||||||
|
Kurulum dizini. Belirtilmezse registry'den okunur.
|
||||||
|
|
||||||
|
.PARAMETER SkipConfirm
|
||||||
|
Onay sorusunu atlar (CI/otomasyon icin)
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\uninstall.ps1
|
||||||
|
.\uninstall.ps1 --install-dir "C:\Program Files\ImajViewer"
|
||||||
|
.\uninstall.ps1 -SkipConfirm
|
||||||
|
#>
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$InstallDir = "",
|
||||||
|
[switch]$SkipConfirm
|
||||||
|
)
|
||||||
|
|
||||||
|
# Renkli cikti
|
||||||
|
function Write-Step { param([string]$Msg) Write-Host "`n> $Msg" -ForegroundColor Cyan }
|
||||||
|
function Write-Ok { param([string]$Msg) Write-Host " [OK] $Msg" -ForegroundColor Green }
|
||||||
|
function Write-Err { param([string]$Msg) Write-Host " [X] $Msg" -ForegroundColor Red; exit 1 }
|
||||||
|
function Write-Warn { param([string]$Msg) Write-Host " [!] $Msg" -ForegroundColor Yellow }
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$AppName = "ImajViewer"
|
||||||
|
$AppExe = "imajviewer.exe"
|
||||||
|
$UninstallGuid = "B8F4A3D2-1C5E-4A7B-9D0F-6E2C8A1B3D5F"
|
||||||
|
|
||||||
|
# ── Kurulum dizinini bul ─────────────────────────────────
|
||||||
|
if (-not $InstallDir) {
|
||||||
|
# Registry'den oku
|
||||||
|
$regPaths = @(
|
||||||
|
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid",
|
||||||
|
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid"
|
||||||
|
)
|
||||||
|
foreach ($rp in $regPaths) {
|
||||||
|
if (Test-Path $rp) {
|
||||||
|
$InstallDir = (Get-ItemProperty -Path $rp).InstallLocation
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $InstallDir -or -not (Test-Path $InstallDir)) {
|
||||||
|
# Varsayilan dizinleri kontrol et
|
||||||
|
$defaultPaths = @(
|
||||||
|
Join-Path ${env:ProgramFiles(x86)} $AppName,
|
||||||
|
Join-Path $env:ProgramFiles $AppName,
|
||||||
|
Join-Path $env:LOCALAPPDATA $AppName
|
||||||
|
)
|
||||||
|
foreach ($dp in $defaultPaths) {
|
||||||
|
if (Test-Path (Join-Path $dp $AppExe)) {
|
||||||
|
$InstallDir = $dp
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $InstallDir) {
|
||||||
|
Write-Err "$AppName kurulumu bulunamadi. Manuel olarak kaldirmak icin Ayarlar > Uygulamalar kullanin."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " ImajViewer Kaldirma" -ForegroundColor White
|
||||||
|
Write-Host "=" * 60 -ForegroundColor White
|
||||||
|
Write-Host " Install Dir : $InstallDir" -ForegroundColor Gray
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# ── Onay ─────────────────────────────────────────────────
|
||||||
|
if (-not $SkipConfirm) {
|
||||||
|
$answer = Read-Host " Tum $AppName dosyalari ve ayarlari silinecek. Devam etmek istiyor musunuz? (E/H)"
|
||||||
|
if ($answer -ne 'E' -and $answer -ne 'e') {
|
||||||
|
Write-Host " Kaldirma iptal edildi." -ForegroundColor Yellow
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Surucu olan process'leri kapat ───────────────────────
|
||||||
|
Write-Step "$AppExe process'leri kontrol ediliyor..."
|
||||||
|
$processes = Get-Process -Name (Split-Path $AppExe -Leaf) -ErrorAction SilentlyContinue
|
||||||
|
if ($processes) {
|
||||||
|
foreach ($p in $processes) {
|
||||||
|
Write-Host " Kapaniyor: $($p.Id) ($($p.Path))" -ForegroundColor Yellow
|
||||||
|
$p | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
Start-Sleep -Seconds 1
|
||||||
|
}
|
||||||
|
Write-Ok "Process kontrolu tamam"
|
||||||
|
|
||||||
|
# ── Kurulum dizinini sil ─────────────────────────────────
|
||||||
|
Write-Step "Kurulum dizini siliniyor..."
|
||||||
|
if (Test-Path $InstallDir) {
|
||||||
|
Remove-Item -Path $InstallDir -Recurse -Force
|
||||||
|
Write-Ok "$InstallDir silindi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Registry: Uninstall girdisi ─────────────────────────
|
||||||
|
Write-Step "Registry girdileri temizleniyor..."
|
||||||
|
|
||||||
|
$regPaths = @(
|
||||||
|
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid",
|
||||||
|
"HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$UninstallGuid"
|
||||||
|
)
|
||||||
|
foreach ($rp in $regPaths) {
|
||||||
|
if (Test-Path $rp) {
|
||||||
|
Remove-Item -Path $rp -Recurse -Force
|
||||||
|
Write-Ok "Registry silindi: $rp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Applications registry girdisi
|
||||||
|
$appRegKey = "HKCU:\Software\Classes\Applications\$AppExe"
|
||||||
|
if (Test-Path $appRegKey) {
|
||||||
|
Remove-Item -Path $appRegKey -Recurse -Force
|
||||||
|
Write-Ok "Applications registry girdisi silindi"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Kisayollari sil ─────────────────────────────────────
|
||||||
|
Write-Step "Kisayollar siliniyor..."
|
||||||
|
|
||||||
|
$startMenuPaths = @(
|
||||||
|
Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs",
|
||||||
|
[Environment]::GetFolderPath("CommonPrograms")
|
||||||
|
)
|
||||||
|
foreach ($sm in $startMenuPaths) {
|
||||||
|
$lnk = Join-Path $sm "$AppName.lnk"
|
||||||
|
if (Test-Path $lnk) {
|
||||||
|
Remove-Item $lnk -Force
|
||||||
|
Write-Ok "Start Menu kisayolu silindi: $lnk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$desktop = [Environment]::GetFolderPath("Desktop")
|
||||||
|
$desktopLnk = Join-Path $desktop "$AppName.lnk"
|
||||||
|
if (Test-Path $desktopLnk) {
|
||||||
|
Remove-Item $desktopLnk -Force
|
||||||
|
Write-Ok "Masaustu kisayolu silindi: $desktopLnk"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Tamamlandı ──────────────────────────────────────────
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host " $AppName basariyla kaldirildi!" -ForegroundColor Green
|
||||||
|
Write-Host ("=" * 60) -ForegroundColor Green
|
||||||
|
Write-Host ""
|
||||||
Reference in New Issue
Block a user