Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
save files dynamically via iw_ostream
System
Hi!
I want to save files dynamically via iw_ostream, so that my cleated files end up in the same directory that my generated file does. Is it possible? Does anyone know how?
/j
http://jonk.svart.nu
Find more posts tagged with
Comments
Migrateduser
It should be easy -
Just extract the file name of the generated file using iwpt_get_ofile_name.
Then set the path in your additional ostreams to include that path.
Migrateduser
Here is a little code fragment that does the trick. The iwperl section gets the path relative the the workarea. Then with iwostream, workarea-relative pathing is used, together with the path fragment to output the file in the same directory.
<iw_perl><![CDATA[
my $ofile_dir = iwpt_get_ofile_name('dirname');
$ofile_dir =~ s|\\|/|g;
$ofile_dir =~ m|^.+/WORKAREA/[^/]+(/.+$)|;
my $work_rel_dir = $1;
]]></iw_perl>
<iw_ostream file="{iw_value name='$work_rel_dir'/}/fragment.html">
Blah blah
</iw_ostream>