-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add experimental support for Clickteam installers #3
Conversation
Rename `WrappedClickteam` to `WrappedFolder` Retry with cicdec if 7z fails Move clickteam extraction to separate function
Additionally, this slightly fixes the WrappedFolder -> WrappedArchive interface and extracts the exe into a temporary folder.
cc99bd4
to
0d09d13
Compare
Apparently, I haven't been able to replicate the 260 character issue on Linux. Could you confirm that this is still a problem and is due to the length of the paths and not some other special characters? Does the limit apply to the input file, the output directory or the I've also noticed another small problem. Cicdec doesn't detect that it runs non-interactively and may sometimes prompt for confirmation if there are duplicate or pre-existing files. This problem is minimized by extracting to a random temp folder. If a single installer file contains duplicates, the command should timeout and fail. |
Sorry for the delay, had some other things on my mind last week. I can confirm that it is still a problem due to the length of the path. It seems that the problem is that the path cicdec tries to extract to is too long. I tried it for example with 2639 and 2641 jerome avenue and put the installer at the location cicdec thisisaclickteaminstallerwithanextremelylongnamethatiswaytooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooolongforwindowstohandle.exe in that folder, it gives the following error:
My Windows is in Dutch, but the message "Het opgegeven pad, de bestandsnaam of beide zijn te lang. De volledig gekwalificeerde bestandsnaam moet minder dan 260 tekens bevatten en de mapnaam minder dan 248 tekens." means "The given path, the filename or both are too long. The fully qualified filename has to be less than 260 characters and the folder name has to be less than 248 characters". |
To avoid potential problems with 260 character limits on Windows, we hash the URL used in the temporary paths of nested zip/jar/exe files. The URL-based paths in the cache are not changed by this.
3aa04ac
to
e38efd1
Compare
Ok, thanks for testing. We're probably ok then in terms of path lengths. I've shortened one of the temporary paths, so they are not too long now, as long as sc4pac isn't installed in a very deep folder or an archive contains very long folder and file names.
You can test it with the updated While the gracie-manor installer extracts flawlessly, the jerome-avenue one still fails to extract and I'm not sure if we can do much about it.
|
It seems cicdec gets the installer version wrong. Manually extracting with the option |
That's weird. When I tried it by putting the installer in a path that's not too long, it correctly extracted all the files and recognized the installer version was 35. Cicdec itself states though that the version detection might not always work properly. As far as I'm aware, no version information is stored in the installer itself, so if no version is explicitly specified, cicdec just tries to parse it as all versions it knows, and then when it's reading stuff that it considers garbage, it assumes that this can't be the correct version. See https://github.com/Bioruebe/cicdec/blob/master/cicdec/Program.cs#L215 and https://github.com/Bioruebe/cicdec/blob/master/cicdec/FileInfo.cs#L57 for the logic. No clue why it does it correctly on Windows, but not on Linux. It could be an option to add the installer version to the metadata of the asset. Something like assetId: aaron-graham-2639-and-2641-jerome-avenue
url: https://community.simtropolis.com
version: 1.0.0
lastModified: ""
installer:
type: clickteam
version: 35 |
I've filed an upstream report at Bioruebe/cicdec/issues/10. It looks like cicdec uses a file-system-dependent .NET API to determine whether or not the extracted paths contain invalid characters. On Linux/ext4, it's just that more characters are valid. Initially, I was considering to just try all the installer versions until extraction succeeds, but, seeing that this creates garbage files on the file system, this seems unsafe. Your proposal of extending the metadata might be the best approach, even though this adds more complexity to the process of writing metadata. |
The current branch is ready for merging. I'm going to create a new release with the cicdec.exe included. If you have the chance, could you give this .bat file a quick sanity check? Setting the environment variable here is something I haven't tested yet. sc4pac-tools/src/scripts/sc4pac.bat Lines 14 to 16 in 04435a7
|
Tested the .bat file and it's working nicely. 👍 |
Awesome, thanks for confirming and for your contribution here. It's merged into 0.4.2. |
This PR adds experimental support for Clickteam installers (see #2) with the cicdec tool.
I am a total novice to Scala, so I had to search my way through the code a bit, but I've ended with something that works. I couldn't find a way to pass the type of the asset all the way down to the
WrappedArchive.apply()
method (as proposed in #2), so the solution I went for is to just try 7zip first, and if it fails trycicdec
.Currently this requires the
cicdec.exe
to be in the PATH variable, but it could be possible to bundlecicdec.exe
with the tool as well of course.I've tested this with the following yaml file:
Known issues:
cicdec
tool does not work with filepaths longer than 260 characters. This is a bit problematic because the file paths can get quite long in the cache. I will see if I can find a workaround with using a different temp folder if it is detected that the file path is too long.