mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-12-07 14:53:40 +00:00
Fix mistypos in the post-install script
Fix mistypos in the post-install script, Fix decompression process when the file contains single root
This commit is contained in:
parent
3058d6c190
commit
c37d42418d
|
|
@ -91,7 +91,7 @@ function ADBObject() {
|
|||
};
|
||||
|
||||
// set the binary path
|
||||
this.binPath = SYS.getAppDataDir() + "\\android_platform_tools\\platform-tools\\adb.exe";
|
||||
this.binPath = SYS.getAppDataDir() + "\\android_platform_tools\\adb.exe";
|
||||
this._interface.setPrefix(this.binPath);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -289,28 +289,42 @@ function Extract-CompressedFile {
|
|||
Write-Host " $CompressedPath"
|
||||
Write-Host " -> $DestinationDirectory"
|
||||
|
||||
# Ensure destination directory exists
|
||||
# Ensure destination directory exists (clean)
|
||||
Ensure-EmptyDirectory -Path $DestinationDirectory
|
||||
|
||||
# Temporary extraction workspace inside destination directory
|
||||
# Temporary extraction workspace
|
||||
$tmpExtractDir = Join-Path $DestinationDirectory "_tmp_extract"
|
||||
Ensure-EmptyDirectory -Path $tmpExtractDir
|
||||
|
||||
# Extract archive
|
||||
# Extract all
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($CompressedPath, $tmpExtractDir)
|
||||
|
||||
# Move all items from temp folder to final destination
|
||||
Get-ChildItem -Path $tmpExtractDir -Force | ForEach-Object {
|
||||
# Detect source root to move from
|
||||
$entries = Get-ChildItem -Path $tmpExtractDir -Force
|
||||
$SourceRoot = $tmpExtractDir
|
||||
|
||||
if ($entries.Count -eq 1 -and $entries[0].PSIsContainer) {
|
||||
# ZIP contains exactly one top-level folder → unwrap that folder
|
||||
$SourceRoot = $entries[0].FullName
|
||||
Write-Host "[*] Detected single root folder inside zip: $($entries[0].Name)"
|
||||
Write-Host "[*] Unwrapping folder content..."
|
||||
}
|
||||
else {
|
||||
Write-Host "[*] Extracting multi-item archive (no root folder unwrapping needed)."
|
||||
}
|
||||
|
||||
# Move all items from source root to final destination
|
||||
Get-ChildItem -Path $SourceRoot -Force | ForEach-Object {
|
||||
$targetPath = Join-Path $DestinationDirectory $_.Name
|
||||
|
||||
if (Test-Path $targetPath) {
|
||||
# If the target exists, remove it (file or directory)
|
||||
Remove-Item -Path $targetPath -Recurse -Force
|
||||
}
|
||||
Move-Item -Path $_.FullName -Destination $targetPath
|
||||
}
|
||||
|
||||
# Remove the temporary extraction directory
|
||||
# Cleanup
|
||||
Remove-Item -Path $tmpExtractDir -Recurse -Force
|
||||
}
|
||||
|
||||
|
|
@ -828,7 +842,7 @@ try {
|
|||
|
||||
# Android Platform Tools (component: android_platform_tools)
|
||||
if (Test-ComponentSelected -Name "android_platform_tools") {
|
||||
if (Test-Path $WinDivertCompressed) {
|
||||
if (Test-Path $AndroidPlatformToolsCompressed) {
|
||||
Extract-CompressedFile `
|
||||
-CompressedPath $AndroidPlatformToolsCompressed `
|
||||
-DestinationDirectory (Join-Path $TargetDir "android_platform_tools")
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ Name: "tessdata_best"; Description: "Download the pre-trained Tesseract OCR data
|
|||
Name: "tessdata_fast"; Description: "Download the pre-trained Tesseract OCR data (faster)"; Types: custom;
|
||||
Name: "gtk3runtime"; Description: "Download and install GTK3 runtime for Windows"; Types: custom;
|
||||
Name: "gtkserver"; Description: "Download GTK-server (GTK GUI interpreter)"; Types: custom;
|
||||
Name: "nmap"; Description: "Download and Nmap and Npcap"; Types: custom;
|
||||
Name: "nmap"; Description: "Download Nmap and Npcap"; Types: custom;
|
||||
Name: "windivert"; Description: "Download WinDivert (Windows Packet Divert)"; Types: custom;
|
||||
Name: "android_platform_tools"; Description: "Download Android Platform Tools"; Types: custom;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user