nmrugg / UE4Launcher

The Unofficial Cross-Platform UE4 Launcher
MIT License
115 stars 19 forks source link

huge download did not extract properly and the chunks got deleted (I did a temporary scratch patch that helped to workaround only, not to commit) #20

Open AquariusPower opened 2 years ago

AquariusPower commented 2 years ago

after downloading more than 30 assets w/o a problem, the infiltrator demo, 7.7GB in chunks files became 7.2GB after extracted, the problem was out of free HD space, so many files were missing in the end, there is no validation neither check for free space prior to extraction.

if it could trash instead of delete the files, or just do not delete them, I could just retry extracting. I had to re-download everything (took me 5 hours) as in the ext4 filesystem (linux) it is impossible to recover deleted files.

I patched like this on epicApi.js:

    function onExtractionComplete()
    {
        //console.log("Deleting chunks after extraction");
        console.log("NOT deleting chunks after extraction");
        ///TODO: Delete chunks as they are not needed (but a chunk can be used more than once).
        //deleteDir(chunkBasePath, function ondel()
        //{
            //assetsData[id][appId].extracted = true;
            //saveAssetsData(ondone);
        //});
        assetsData[id][appId].extracted = true;
        saveAssetsData(ondone);
    }
AquariusPower commented 2 years ago

it works, the chunks remained there after extraction, now, to be able to re-download I had to edit assets.json and, for the infiltrator demo, change to: "downloaded":false,"extracted":false before restarting this launcher.

The kept downloaded chunks can be used for re-extracting, we just need to set: "downloaded":true,"extracted":false before restarting this launcher, and you need to be online (a patch could let we do it offline too I guess).

Btw, if weird errors happen, most are related to connection problems, just retry a few times the download (I suggest at least 5 times), and/or restart the launcher a few times too, or try another time or day. Also, make it sure the asset version you want is really available online, if you ask for and there is nothing to UE4.27, only for UE4.26, it will fail.

It is better now I think, I can keep the compressed chunks to re-extract again later if I want, and now I can move (instead of copy) the extracted folder!

If you are going to try this, better move the folders UE4LauncherUnnoficial/UE4Launcher/cache/assets to UE4LauncherUnnoficial/assets and UE4LauncherUnnoficial/UE4Launcher/node_modules to UE4LauncherUnnoficial/node_modules and then symlink them to their original places. This way you can create small backups of the UE4LauncherUnnoficial/UE4Launcher/ folder to easily restore if something weird happens.

This could be a nice patch: