NathanVaughn / msfs-mod-manager

An external mod manager for the new Microsoft Flight Simulator
GNU General Public License v3.0
99 stars 4 forks source link

RAR archive does not extract properly when WinRAR is installed #54

Closed alexgg43 closed 3 years ago

alexgg43 commented 3 years ago

Expected Behavior

Using version 1.0 7Zip 32 and 64 installed

When i select a rar archive in "Install from achive" wizard i get an arror.

Actual Behavior

I shound not.

For info when changing the file extention to .zip it works (the archive is still a rar bur renammed as a zip)

Specifications

Debug Log Contents (only if reporting a bug)

This file is found at %APPDATA%\MSFS Mod Manager\debug.log

2021-02-02 23:30:53.703 | DEBUG | lib.thread:run:22 - Running thread 2021-02-02 23:30:53.704 | DEBUG | lib.flight_sim:install_mod_archive:565 - Installing mod C:/Users/Alexandre/Desktop/[LEBL] Barcelona El Prat.rar 2021-02-02 23:30:53.705 | DEBUG | lib.files:delete_folder:267 - Attempting to delete folder \?\C:\Users\Alexandre\AppData\Local\Temp\MSFS Mod Manager 2021-02-02 23:30:53.707 | DEBUG | lib.files:create_tmp_folder:349 - Creating temp folder C:\Users\Alexandre\AppData\Local\Temp\MSFS Mod Manager 2021-02-02 23:30:53.708 | DEBUG | lib.files:extract_archive:390 - Extracting archive C:/Users/Alexandre/Desktop/[LEBL] Barcelona El Prat.rar to C:\Users\Alexandre\AppData\Local\Temp\MSFS Mod Manager[LEBL] Barcelona El Prat 2021-02-02 23:30:53.709 | DEBUG | lib.thread:run:28 - Thread completed 2021-02-02 23:30:53.744 | ERROR | widgets.main_widget:base_fail:212 - Failed to install mod archive 2021-02-02 23:30:53.745 | ERROR | widgets.main_widget:base_fail:213 - <class 'NotADirectoryError'>: [WinError 267] Nom de répertoire non valide

debug log
NathanVaughn commented 3 years ago

I just tried it with a different .rar file I have. I'm pretty sure your issue is that this file is misnamed, as in, it really is a .zip file with the extension .rar. There should be a better error message for this, though, so I'll implement a fix.

alexgg43 commented 3 years ago

I have just tried to extract the archive, recreate one from the extracted folder with winrar then tried to install again from this new archive (It is a rar not a rar4) and it still shows the same issue.

alexgg43 commented 3 years ago

I tried many combinaison. My conclusion is that whatever the archive really is (zip,7zip,rar), if the file extension is rar then it fails.

alexgg43 commented 3 years ago

I had both 7Zip and Winrar installed. Uninstalling Winrar solved the issue. I precise that i first tried to set rar default openning program to 7zip without sucess. I read your code and understood that you're using patoolib "patoolib.extract_archive". To me the problem comes from how patoolib manages rar files.

NathanVaughn commented 3 years ago

Thanks for mentioning the WinRAR thing. Once I installed it myself on my machine, I can also replicate the issue. I'll spend more time investigating and coming up with a fix.

On Wed, Feb 3, 2021 at 12:56 PM alexgg43 notifications@github.com wrote:

I had both 7Zip and Winrar installed. Uninstalling Winrar solved the issue. I precise that i first tried to set rar default openning program to 7zip without sucess. I read your code and understood that you're using patoolib "patoolib.extract_archive". To me the problem comes from how patoolib manages rar files.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/NathanVaughn/msfs-mod-manager/issues/54#issuecomment-772730376, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4QK36ZFQ4H3F6DDETUDTS5GLATANCNFSM4W7Y3UUQ .

NathanVaughn commented 3 years ago

Found the issue. WinRar from the command-line won't extract an archive if the output directory doesn't already exist, unlike 7zip. It was a 1-line fix: a9450fc9da2c1e15ec51f06a9b5adab97b8542eb

NathanVaughn commented 3 years ago

Fixed in version 1.0.1

alexgg43 commented 3 years ago

Great Nathan !