Stefan Monov
Stefan Monov

Reputation: 11732

Is it ok to deploy/access separate files rather than using the Qt Resource System which puts them all into the executable?

Qt's resource system lets you build an executable that has resources (.qml's, images...) embedded inside it. I'd like to load the files from the filesystem instead, and ship them alongside my executable. Is this a technique supported by Qt? Any gotchas? Any advantages to one way or the other?

Upvotes: 1

Views: 107

Answers (2)

Qt doesn't limit you in what you can do here. It's your choice. Qt's resource system is there if you want it, it's not forced down your throat. Not using it doesn't make you automatically wrong.

If you want to deploy files along with your application, go for it - if it makes sense for your particular application.

My personal preference for small (<0.25GB) applications is for a nice monolithic portable executable on Windows, with everything inside, that you don't have to install if you don't wish - mimicking how an app bundle would be on OS X.

The portability helps, as does the slightly stronger locality of reference: most filesystems will attempt to keep a file's blocks together a bit harder than they do for files that merely are in the same folder.

If there's any utility in power users tweaking the contents of the deployed files, then certainly using the files over using resources has advantages. You could also use the resource system as a fallback for files that are missing - that way a user could provide a replacement file optionally, if it's something you could use.

Upvotes: 2

maxik
maxik

Reputation: 1123

To make it short: If it is applicable for your application and 'business model' it is ok.


Besides being supported by Qt using QFile (for example), Qt's resource system has some advantages:

  • compression (ZIP)
  • simple usage in the application
  • no care about missing files (typically)

If you mind adding all resources to the executable will not work for you and you want to seperate them, look at the option of seperate (binary) resource files with Qt.

Upvotes: 1

Related Questions