bfishman / Docking-Port-Alignment-Indicator

Official repository of the DPAI mod for Kerbal Space Program
MIT License
20 stars 7 forks source link

Bad ZIP format for 6.9.2.1 #11

Closed HebaruSan closed 3 years ago

HebaruSan commented 3 years ago

The ZIP standard says to use / and not to use \:

   4.4.17.1 The name of the file, with optional relative path.
   The path stored MUST NOT contain a drive or
   device letter, or a leading slash.  All slashes
   MUST be forward slashes '/' as opposed to
   backwards slashes '\' for compatibility with Amiga
   and UNIX file systems etc.  If input came from standard
   input, there is no file name field.  

The latest release of DPAI has lots of backslashes:

image

Hence it has not been indexed into CKAN:

image

Previous releases were fine. I think most times when we see this, authors report using some .NET tool to build the ZIP.

mwerle commented 3 years ago

I think most times when we see this, authors report using some .NET tool to build the ZIP.

Hmm, indeed, but I've been doing this for a while now for several of my mods, including DPAI. Admittedly I'm using a different PC than usual at the moment.

I didn't even know ZIP files stored an actual directory structure using slashes..

I'll look into why it's different on this PC. FWIW, this is the script I've been using:

<!-- create zip file with content of release\bin folder -->
  <Target Name="ZipRelease"
          DependsOnTargets="getversion;gettime">
    <MakeDir Directories="$(ReleaseDir)" Condition="!Exists('$(ReleaseDir)')" />
    <Delete Files="$(ReleaseDir)\DockingPortAlignmentIndicator-$(DLLVersion)*.zip" />
    <ZipDirectory Condition="Exists('$(BuildDir)')"
                  SourceDirectory="$(BuildDir)"
                  DestinationFile="$(ReleaseDir)\DockingPortAlignmentIndicator-$(DLLVersion)_$(CurrentDate).zip" />
  </Target>
mwerle commented 3 years ago

Ok, it seems DotNet 4.6.1 and later fixed it. Presumably my usual PC uses a later version when executing the MSBUILD (it's unrelated to the actual version used to compile the mod).

I've just spent my entire morning trying to coerce this PC to create the ZIP with forward slashes to no avail.

Anyway, will make a manual update. And will need to remember to check this for all future releases for all my mods. What a nightmare. I bleeping hate Microsoft.

mwerle commented 3 years ago

Fixed in release 6.9.2.2.

mwerle commented 3 years ago

FYI: https://stackoverflow.com/questions/65506284/msbuild-zipdirectory-task-uses-backslash-on-some-computer-but-forward-slash-on-a/65537619#65537619

TL;DR: Use VS2019, then the "ZipDirectory" task creates zip files with forward slashes.