PhoenicisOrg/scripts

Update "Tom Clancy's Rainbow Six 3 : Raven Shield" script

madoar opened this issue · 4 comments

The following changes should be done:

  • change var to const
  • think about replacing Downloader by Resource

new Downloader()
.wizard(wizard)
.url(url)
.checksum(sha1)
.to(originDirectory + exeName)
.get();
wine.run(originDirectory + exeName);

plata commented

The var to const is done. What's the advantage of using Resource? Shouldn't Resource be used only for stuff which is shared between scripts? If you use it to download big files, I think they will remain in the resources directory and fill up your hard drive.

At least you won't have to redownload them everytime.

plata commented

Yes, if you install the app again. That's not the normal use case as far as I'm concerned.

For example in verbs it's different: As multiple apps might use the same verbs, it makes sense to keep the resource.

It is not only about keeping the resource. I see two possible benefits of using Resource over Downloader:

  • Resource could be imagined as a temporary object (i.e. file or directory) that is automatically deleted after exiting the script. This is useful for example when downloading archives or installers that should be deleted afterwards anyway
  • Resource returns the path leading to the downloaded file, this means that you don't need to do any path building on the calling site (e.g. originDirectory + exeName). This reduces the number of possible errors a script developer can do (for example I'm often asking myself the question: Is there a "/" missing between originDirectory and exeName?)

In addition Resource uses Downloader internally so it is essentially the same anyway