Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
converting vpath into filename
srosewall
Hi,
Does anyone have a favourite way of taking a vpath and converting it to a filename format?
I'd like to take the branch information available to a workflow , strip out some useful info and convert it into a part of a filename so I can pick up a branch based configuration file.
I'm hoping that there's a neat Perl module (hopefully from IWOV) that I can tap into. If not then I'll do some Perl'ing of my own.
Cheers
Stuart Rosewall
Find more posts tagged with
Comments
Adam Stoller
I'm not sure I understand what you are trying to accomplish here - can you provide an example?
A vpath is generally a filesystem path without the mount point (Y:, /iwmnt, /.iwmnt) preceding it.
An area-relative vpath is the filesystem path from the current directory (.) but without the dot (e.g. [/default/main/www/WORKAREA/waname]/htdocs/something/foo.html)
The branch name can be retrieved from a full vpath using fairly simple regular expressions:
$fullvpath = "/default/main/www/WORKAREA/waname/htdocs/something/foo.html";
if ($fullvpath =~ m%^/default/.*/([^/]+)/(STAGING|EDITION|WORKAREA)/.*%){
$branch = $1;
}
I'm not sure if this answers your question - so as I said, if you provide an example of what you're starting with and what you want to end with - it will be easy for someone to assist you.
--fish
(Interwoven Senior Technical Consultant)
srosewall
Here's the plan:
I get /default/main/bla/bla/bla from iw_branch in a wft.
I'd like to use the branch path I get to pick up a branch specific cfg file (different branches will have different cfg files for the same wft).
So I intend to strip the branch path string down and insert some "_"'s here and there.
I've whacked some Perl code together to do this, but just before I move on to my next bit of development work I was just wanting to know if there are any IWOV PM's available to do the job for me...
Hopefully someone will go - "ah, you want to be using TeamSite::widget - that'll do the job for you". Then again perhaps not.
If there's nothing I can call upon then I'll go with my own bit of code.
Cheers
Stuart
Migrateduser
I'm pretty sure one simple regex would do what you want - but it's still not clear what you want as output. Can you provide a real example of a string you would pass this function and what string you'd want returned to you?
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
srosewall
No you're probably right - regex it... I've got something in place now that pretty much does what I want.
Thanks for the responses.
Cheers
Stuart