mirror of
https://github.com/winapps-org/winapps.git
synced 2025-05-31 20:37:18 +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
|
||||
)
|
||||
|
||||
if ((Get-Item $exePath).VersionInfo.FileDescription) {
|
||||
# Remove leading/trailing whitespace and replace multiple spaces with a single space.
|
||||
try {
|
||||
$productName = (Get-Item $exePath).VersionInfo.FileDescription.Trim() -replace '\s+', ' '
|
||||
} else {
|
||||
# Get the executable file name without the file extension.
|
||||
} catch {
|
||||
$productName = [System.IO.Path]::GetFileNameWithoutExtension($exePath)
|
||||
}
|
||||
|
||||
@ -125,10 +123,7 @@ function GetUWPApplicationName {
|
||||
|
||||
# Query the application executable for the application name.
|
||||
if (Test-Path $exePath) {
|
||||
if ((Get-Item $exePath).VersionInfo.FileDescription) {
|
||||
# Remove leading/trailing whitespace and replace multiple spaces with a single space.
|
||||
$productName = (Get-Item $exePath).VersionInfo.FileDescription.Trim() -replace '\s+', ' '
|
||||
}
|
||||
$productName = GetApplicationName -exePath $exePath
|
||||
}
|
||||
|
||||
# Use the 'DisplayName' (if available) if the previous method failed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user