mirror of
https://github.com/winapps-org/winapps.git
synced 2025-06-02 13:17:19 +02:00
fix: catch error if exe has no version info
This commit is contained in:
parent
95daa5d837
commit
4e3d5bd458
@ -103,11 +103,9 @@ function GetApplicationName {
|
|||||||
[string]$exePath
|
[string]$exePath
|
||||||
)
|
)
|
||||||
|
|
||||||
if ((Get-Item $exePath).VersionInfo.FileDescription) {
|
try {
|
||||||
# Remove leading/trailing whitespace and replace multiple spaces with a single space.
|
|
||||||
$productName = (Get-Item $exePath).VersionInfo.FileDescription.Trim() -replace '\s+', ' '
|
$productName = (Get-Item $exePath).VersionInfo.FileDescription.Trim() -replace '\s+', ' '
|
||||||
} else {
|
} catch {
|
||||||
# Get the executable file name without the file extension.
|
|
||||||
$productName = [System.IO.Path]::GetFileNameWithoutExtension($exePath)
|
$productName = [System.IO.Path]::GetFileNameWithoutExtension($exePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,10 +123,7 @@ function GetUWPApplicationName {
|
|||||||
|
|
||||||
# Query the application executable for the application name.
|
# Query the application executable for the application name.
|
||||||
if (Test-Path $exePath) {
|
if (Test-Path $exePath) {
|
||||||
if ((Get-Item $exePath).VersionInfo.FileDescription) {
|
$productName = GetApplicationName -exePath $exePath
|
||||||
# Remove leading/trailing whitespace and replace multiple spaces with a single space.
|
|
||||||
$productName = (Get-Item $exePath).VersionInfo.FileDescription.Trim() -replace '\s+', ' '
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use the 'DisplayName' (if available) if the previous method failed.
|
# Use the 'DisplayName' (if available) if the previous method failed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user