Reputation: 171
My application receives a clearcase source container path (from a snapshot view) like this: \hostmachine\vobs\VOBNAME.vbs\c\cdft\1e\1d\92a7e1286af9489595a9df220730e1e3
Assuming I know the type of document (PDF, Word, Excel, Text etc), I can open this path with its associated application. But how do I obtain the file type from this path?
I know that the original file name can be gotten using cleartool desc command:
cleartool desc oid:92a7e1286af9489595a9df220730e1e3
but this only works if I set my working directory to the view containing the VOB. Since all I have is the source container path - I don't know what view it came from. Is there any way to obtain the original name of the file using this path without knowing the path of the view?
Alternatively, is there a simple way to determine which snapshot view contains this path?
Upvotes: 1
Views: 2308
Reputation: 961
There is sufficient documentation for this, but it isn't quite obvious to connect the dots to solve your problem, see:
cleartool man fmt_ccase
Notice the %Xn and %n specifiers, which means you can do:
cleartool desc -fmt "%Xn\n" oid:<oid-str>@<vob-prefix>
For example:
cleartool desc -fmt "%Xn\n" oid:92a7e1286af9489595a9df220730e1e3@\MYVOB
or
cleartool desc -fmt "%Xn\n" oid:92a7e1286af9489595a9df220730e1e3@/vobs/MYVOB
or
cleartool desc -fmt "%Xn\n" oid:92a7e1286af9489595a9df220730e1e3@@vobuuid:<vob-oid>
But keep in mind that strictly speaking, it isn't possible to get the element path portion of the file/version without a view context due to XPN paths being inherently ambiguous (many possible "evil twin" scenarios)--so you either need to establish a view context with the same view where the file/version of interest was accessed, or you need to create your own dedicated view with the same config-spec to use with the commands above.
Upvotes: 0
Reputation: 1323633
This old thread (2006) mentions trying a cleartool dump
.
I know it is executing in a view, but it might be worth it to try it in any of your dynamic views, just to see if it might still work.
2027]dilip@sun3> ct pwv ; pwd ; ls
Working directory view: ** NONE **
Set view: 2.dilip
/vob_store/TEST_VOB.vbs/c/cdft/32/14
1c194c97205e4d25bb1d6e2053e4c27a a28b1e28b23342b3a4fd507703dbfc7f
edbf360518b040339038399b7a0479a1
419e3e622be2474bbe3fd52925a3273d c63ab80cf44711d98ee0000d9d4a0e31
2029dilip@sun123> ct dump oid:a28b1e28b23342b3a4fd507703dbfc7f*
@/vobs/TEST_VOB*
oid:a28b1e28b23342b3a4fd507703dbfc7f@/vobs/TEST_VOB
/vobs/TEST_VOB/docs/helle.c@@/main/1
oid=a28b1e28.b23342b3.a4fd.50:77:03:db:fc:7f dbid=15385 (0x3c19)
mtype=version
stored fstat:
Upvotes: 1