Skip to content

Commit

Permalink
Make sure we add a trailing backslash when extracting.
Browse files Browse the repository at this point in the history
I'm updating update-manifests.bat with this change since it could be a concern if it's not fixed there for people who still use it.
  • Loading branch information
DrewNaylor committed Oct 5, 2020
1 parent 203cc6d commit 5d5c4b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions libguinget/PackageListTools.vb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Public Class PackageListTools
Try
If System.IO.File.Exists(tempDir & "\winget-pkgs-master.zip") Then
' Now extract.
ZipFile.ExtractToDirectory(tempDir & "\winget-pkgs-master.zip", tempDir & "\winget-pkgs-master")
ZipFile.ExtractToDirectory(tempDir & "\winget-pkgs-master.zip", tempDir & "\winget-pkgs-master\")
End If
Catch ex As System.IO.FileNotFoundException
MessageBox.Show("Couldn't find " & tempDir & "\winget-pkgs-master.zip",
Expand All @@ -278,7 +278,7 @@ Public Class PackageListTools
Try
If System.IO.File.Exists(DatabaseTempDir & "\source.msix") Then
' Now extract.
ZipFile.ExtractToDirectory(DatabaseTempDir & "\source.msix", DatabaseTempDir & "\source")
ZipFile.ExtractToDirectory(DatabaseTempDir & "\source.msix", DatabaseTempDir & "\source\")
End If
Catch ex As System.IO.FileNotFoundException
MessageBox.Show("Couldn't find " & DatabaseTempDir & "\source.msix",
Expand All @@ -297,8 +297,8 @@ Public Class PackageListTools
' The calling app wants to use 7zip, so use it.
Dim extraction7z As New Process
extraction7z.StartInfo.FileName = PathTo7zip
extraction7z.StartInfo.Arguments = "x -bd " & tempDir & "\winget-pkgs-master.zip -o" & tempDir & "\winget-pkgs-master"
extraction7z.Start()
extraction7z.StartInfo.Arguments = "x -bd " & tempDir & "\winget-pkgs-master.zip -o" & tempDir & "\winget-pkgs-master\"
extraction7z.Start()
' Wait for 7zip to exit, otherwise it'll move on too soon.
extraction7z.WaitForExit()

Expand All @@ -307,7 +307,7 @@ Public Class PackageListTools
' This is for the database.
Dim extraction7zDatabase As New Process
extraction7zDatabase.StartInfo.FileName = PathTo7zip
extraction7zDatabase.StartInfo.Arguments = "x -bd " & DatabaseTempDir & "\source.msix -o" & DatabaseTempDir & "\source"
extraction7zDatabase.StartInfo.Arguments = "x -bd " & DatabaseTempDir & "\source.msix -o" & DatabaseTempDir & "\source\"
extraction7zDatabase.Start()
' Wait for 7zip to exit, otherwise it'll move on too soon.
extraction7zDatabase.WaitForExit()
Expand Down
6 changes: 3 additions & 3 deletions update-manifests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Rem https://gist.github.com/DrewNaylor/22e3f1cded702fff494a46dabe643fde


REM Current script version:
set VERSIONNUMBER=2020.05-2
set VERSIONNUMBER=2020.10-1

REM Create variable for the titlebar text when not doing anything:
set REGULAR_TITLE_BAR=update-manifests Version %VERSIONNUMBER%
Expand Down Expand Up @@ -46,7 +46,7 @@ echo If anything happens to your computer, Drew Naylor is not responsible. Use a
echo Please visit https://github.com/DrewNaylor/guinget/ for more information on this script's parent project, guinget, which is open source.
echo(

echo The purpose of update-manifests is to expediate the downloading and extracting of winget sources from Microsoft's Community Package Repository. For now, this is the only source supported, but the goal is to support more sources in the future, along with winget gaining that feature whenever it does. Eventually guinget will get its own manifest updater, so this script is just a temporary solution. update-manifests will use PowerShell to download a Zip file from github.com and extract it into "%AppData%\winget-frontends\source\winget-pkgs\pkglist\manifests" using PowerShell and robocopy. Manifests in this folder can be used by other winget frontends in addition to guinget, if they want to. Additionally, manifests from other sources will be extracted to their own "source\" folder. After copying the manifests, you'll be asked if you want to delete the temp files.
echo The purpose of update-manifests is to expediate the downloading and extracting of winget sources from Microsoft's Community Package Repository. For now, this is the only source supported, but the goal is to support more sources in the future, along with winget gaining that feature whenever it does. Eventually guinget will get its own manifest updater, so this script is just a temporary solution. update-manifests will use PowerShell to download a Zip file from github.com and extract it into "%AppData%\winget-frontends\source\winget-pkgs\pkglist\manifests\" using PowerShell and robocopy. Manifests in this folder can be used by other winget frontends in addition to guinget, if they want to. Additionally, manifests from other sources will be extracted to their own "source\" folder. After copying the manifests, you'll be asked if you want to delete the temp files.

echo(
echo Windows PowerShell 5.0 or greater is required to run this script. Links are available in the System Requirements in the UXL Launcher README file here: https://github.com/DrewNaylor/UXL-Launcher/blob/master/README.md#building-uxl-launcher-from-source-system-requirements-and-guide
Expand Down Expand Up @@ -108,7 +108,7 @@ REM Set titlebar text to the extracting text:
title %EXTRACTING_TITLE_BAR%
echo Extracting package previously downloaded from GitHub...
echo If you want to cancel, please use Ctrl+C.
powershell Expand-Archive -Path "$env:AppData\winget-frontends\source\winget-pkgs\temp\winget-pkgs-master.zip" -DestinationPath " '%AppData%\winget-frontends\source\winget-pkgs\temp\winget-pkgs-master' " -Force
powershell Expand-Archive -Path "$env:AppData\winget-frontends\source\winget-pkgs\temp\winget-pkgs-master.zip" -DestinationPath " '%AppData%\winget-frontends\source\winget-pkgs\temp\winget-pkgs-master\' " -Force
pause

echo(
Expand Down

0 comments on commit 5d5c4b3

Please sign in to comment.