Skip to content

Commit 30ed38f

Browse files
committed
[Fix] Skip second scan of main package from appinstaller
1 parent 02e3fa5 commit 30ed38f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Panels/Img_Ops/AppxPkgs/AddProvAppxPackage.vb

+15-3
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,7 @@ Public Class AddProvAppxPackage
23172317

23182318
Private Sub ListView1_DragDrop(sender As Object, e As DragEventArgs) Handles ListView1.DragDrop
23192319
Dim PackageFiles() As String = e.Data.GetData(DataFormats.FileDrop)
2320+
Dim HasBeenScannedByAppInstaller As Boolean = False
23202321
Cursor = Cursors.WaitCursor
23212322
DynaLog.LogMessage("Interpreting items to add to queue...")
23222323
For Each PackageFile In PackageFiles
@@ -2325,13 +2326,24 @@ Public Class AddProvAppxPackage
23252326
Path.GetExtension(PackageFile).Equals(".eappx", StringComparison.OrdinalIgnoreCase) Or Path.GetExtension(PackageFile).Equals(".emsix", StringComparison.OrdinalIgnoreCase) Or
23262327
Path.GetExtension(PackageFile).Equals(".eappxbundle", StringComparison.OrdinalIgnoreCase) Or Path.GetExtension(PackageFile).Equals(".emsixbundle", StringComparison.OrdinalIgnoreCase) Then
23272328
DynaLog.LogMessage("The item to add " & Quote & Path.GetFileName(PackageFile) & Quote & " is a regular AppX package.")
2328-
ScanAppxPackage(False, PackageFile)
2329+
If Not HasBeenScannedByAppInstaller Then
2330+
ScanAppxPackage(False, PackageFile)
2331+
Else
2332+
' The item has been detected by the app installer package, but the resulting package is already present,
2333+
' so instead of scanning it again, we get rid of an error by ignoring the second scan. Instead of re-scanning
2334+
' the package, we set this flag to false so that we can get more stuff.
2335+
HasBeenScannedByAppInstaller = False
2336+
End If
23292337
ElseIf Path.GetExtension(PackageFile).Equals(".appinstaller", StringComparison.OrdinalIgnoreCase) Then
23302338
DynaLog.LogMessage("The item to add " & Quote & Path.GetFileName(PackageFile) & Quote & " is an App Installer package.")
23312339
If Not AppInstallerDownloader.IsDisposed Then AppInstallerDownloader.Dispose()
23322340
AppInstallerDownloader.AppInstallerFile = PackageFile
2333-
If Not File.Exists(PackageFile.Replace(".appinstaller", GetDownloadedPackageExtensionFromAppInstaller(PackageFile))) Then AppInstallerDownloader.ShowDialog(Me)
2334-
If File.Exists(PackageFile.Replace(".appinstaller", GetDownloadedPackageExtensionFromAppInstaller(PackageFile)).Trim()) Then ScanAppxPackage(False, PackageFile.Replace(".appinstaller", GetDownloadedPackageExtensionFromAppInstaller(PackageFile)).Trim())
2341+
If Not File.Exists(PackageFile.Replace(".appinstaller", GetDownloadedPackageExtensionFromAppInstaller(PackageFile))) Then
2342+
AppInstallerDownloader.ShowDialog(Me)
2343+
Else
2344+
ScanAppxPackage(False, PackageFile.Replace(".appinstaller", GetDownloadedPackageExtensionFromAppInstaller(PackageFile)).Trim())
2345+
HasBeenScannedByAppInstaller = True
2346+
End If
23352347
ElseIf (File.GetAttributes(PackageFile) And FileAttributes.Directory) = FileAttributes.Directory Then
23362348
DynaLog.LogMessage("The item to add is a directory. Getting contents...")
23372349
Dim msg As String = ""

0 commit comments

Comments
 (0)