On Jun 26, 2012, at 3:58 PM, Hamster wrote:
I thought that this should be possible with 2.1
syntax, but I think I am
overlooking something small...
How can I create a link so a Windows Explorer opens to a (network)drive?
For example:
[[Open Temp>>unc:c:\temp\]]
UNC is supposed to be supported in XWiki Syntax 2.1.
Our documentation gives the following examples
(from
http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax):
unc:C:\Windows\
unc:\\myserver\path\img.png
unc:home/user/somefile
What happens when you click on your link?
Note that I've checked the unit test I wrote for this:
[[unc:\\myserver\myshare\mydoc.txt]]
generates in HTML:
<a href="file://///myserver/myshare/mydoc.txt">...
The algorithm I coded is this one:
// Transform the UNC reference into a file URL of the format:
file://///myserver/myshare/mydoc.txt
// i.e. replace all "\" chars by "/" and prefix with
"file:///".
String fileURL = "file:///" +
reference.getReference().replaceAll("\\\\", "/");
Let me know what doesn't work.
Thanks
-Vincent