From 86a29e4a43aadfd84c3ef420b9d6dc7b209f4d13 Mon Sep 17 00:00:00 2001 From: BigfootACA Date: Tue, 13 Jul 2021 17:32:30 +0800 Subject: [PATCH] add extract.ps1 Signed-off-by: BigfootACA --- extract.ps1 | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 extract.ps1 diff --git a/extract.ps1 b/extract.ps1 new file mode 100644 index 0000000..f80fab7 --- /dev/null +++ b/extract.ps1 @@ -0,0 +1,43 @@ +Param([Parameter(Mandatory=$true)][String]$CodeName) +Set-Location -Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) +$Configs="definitions" +$DefConfig="sdm845-generic" +$Config=Join-Path ` + -Path $Configs ` + -ChildPath (-Join ($CodeName,".txt")) +Write-Output $Config +If( -Not (Test-Path -Path $Config)){ + Write-Output "warning: your model has no definition file, use default" + $Config=Join-Path ` + -Path $Configs ` + -ChildPath (-Join ($DefConfig,".txt")) + if( -Not (Test-Path -Path $Config)){ + Write-Output "default definition file not found" + exit 1 + } +} +If(Test-Path -Path output){ + Remove-Item ` + -Recurse ` + -Force ` + -Path output +} +$Output=New-Item ` + -ItemType Directory ` + -Path output +Get-Content ` + -Path $Config | ` + Copy-Item ` + -Recurse ` + -Verbose ` + -Path { "."+$_ } ` + -Destination $Output +Get-ChildItem ` + -Recurse ` + -Path $Output ` + -Filter *.inf_ | ` +Rename-Item ` + -NewName { ` + $_.FullName ` + -Replace '\.inf_','.inf' ` + }