Copy resource to output folder

Started by AboZeid, December 01, 2010, 01:21:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AboZeid

How can I copy a resource file to output folder?
I want to put an image and specified CSS file in the same directory with HTML output files.

Liviu Lalescu


AboZeid

#2
I've an external CSS and images file, and i want to copy these files to output folder (with HTML and XML files) so I can use them in generated HTML files.
I want to make some modification in CSS original file, like add a logo and background image... but I need to copy external images and css files every timetable generate.
I try this within writeSimulationResults() function:
QDir().mkdir(OUTPUT_DIR_TIMETABLES+FILE_SEP+"images");
QFile(":/images/head_bg.png").copy(OUTPUT_DIR_TIMETABLES+FILE_SEP+"images/head_bg.png");

Is there a better way?[/size]

Liviu Lalescu

I think this is a good way to solve your problem.

Another solution would be to use a file copying routine, directly, so that head_bg.png is not stored directly into the memory, but this way you don't have the guarantee that the file head_bg.png is always available.