UNC Path Problem - Resolution

119 views
Skip to first unread message

Simon Huggins

unread,
Aug 19, 2008, 7:18:48 PM8/19/08
to TiddlyWiki
Noticed various people are having problems saving TiddlyWiki to a UNC
path (e.g. \\myserver\mydir\TiddlyWiki.html)

I have had the same problem. Found the fix today after lots of
alert()s!

Edit your tiddlywiki source file as follows:

search for "ieCreatePath(path)" and insert the following line in the
position indicated:

if (pos==-1) pos = path.lastIndexOf("/");

into:

function ieCreatePath(path)
{
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
} catch(ex) {
return null;
}
var pos = path.lastIndexOf("\\");
if (pos==-1) pos = path.lastIndexOf("/");
if(pos!=-1) {
path = path.substring(0,pos+1) }
var scan = [path];
var parent = fso.GetParentFolderName(path);
while(parent && !fso.FolderExists(parent)) {
scan.push(parent);
parent = fso.GetParentFolderName(parent);
}

for(i=scan.length-1;i>=0;i--) {
if(!fso.FolderExists(scan[i])) {
fso.CreateFolder(scan[i]);
}
}
return true;
}


It seems that Internet Explorer in its wisdom converts backslashes to
forward slashes for UNC paths, but not for local paths hence
TiddlyWiki wasn't finding the last slash in the path to strip off the
filename to leave the base path. This fix just searches for a forward
slash if it doesn't find a backslash. Hopefully this will make itself
into a forthcoming release to avoid the hack.

Regards

Simon Huggins.

FND

unread,
Aug 20, 2008, 5:29:51 AM8/20/08
to Tiddl...@googlegroups.com
> Noticed various people are having problems saving TiddlyWiki to a UNC
> path (e.g. \\myserver\mydir\TiddlyWiki.html)
> I have had the same problem. Found the fix today

Thanks, Simon!
We'll look into this and hopefully provide a fix for the core.

> Edit your tiddlywiki source file as follows: [...]

You should never edit the TiddlyWiki source directly (as that makes
upgrading difficult). Instead you can override this core function with a
simple plugin; simply drop your code into a tiddler and tag it with
"systemConfig".


-- F.

Simon Huggins

unread,
Aug 20, 2008, 6:53:40 AM8/20/08
to TiddlyWiki
Thanks for that. Look forward at trying my hand at a plugin. I created
a Crossword program that generated a web page for an interactive
crossword some years ago - might be fun to see if this could generate
a tiddler plugin so people could do puzzles in their TiddlyWiki. I
know - bit daft.

Simon.

FND

unread,
Aug 20, 2008, 6:55:54 AM8/20/08
to Tiddl...@googlegroups.com
> Look forward at trying my hand at a plugin. I created
> a Crossword program that generated a web page for an interactive
> crossword some years ago - might be fun to see if this could generate
> a tiddler plugin so people could do puzzles in their TiddlyWiki.

Sounds interesting, actually!
You might also be interested in this:
http://www.tiddlywiki.org/wiki/Dev:Plugin_Specifications#Template


-- F.

Marc Stober

unread,
Aug 21, 2008, 3:37:28 PM8/21/08
to TiddlyWiki
And if using IE7 replace the first line with:
window.ieCreatePath = function(path) {
...

As I discovered all the way at the bottom of this page:
http://www.tiddlywiki.org/wiki/Dev:Custom_Macros

Simon Huggins

unread,
Aug 21, 2008, 9:24:44 PM8/21/08
to TiddlyWiki
Where does it indicate this? This page seems to be about macros - not
sure how it relates to the change you've made (oh - is it that because
the change is being made dynamically within a tiddler that it needs to
identify the context of the function as being at window level?)
> > Simon Huggins.- Hide quoted text -
>
> - Show quoted text -

Koen

unread,
Aug 25, 2008, 9:40:25 AM8/25/08
to TiddlyWiki, blo...@simonhuggins.com
Simon,

Permalinks seem to work fine using your solution. I'm still not able
to edit tiddlers over UNC however. I'm sure the archaic browser
version (IE6) has something to do with it.

I'll try to upload your solution in the form of a plugin.

Regards

Koen

Eric Shulman

unread,
Aug 26, 2008, 4:55:10 PM8/26/08
to TiddlyWiki
> We'll look into this and hopefully provide a fix for the core.

I've opened a ticket: http://trac.tiddlywiki.org/ticket/749

> > Edit your tiddlywiki source file as follows: [...]
>
> You should never edit the TiddlyWiki source directly (as that makes
> upgrading difficult). Instead you can override this core function with a
> simple plugin; simply drop your code into a tiddler and tag it with
> "systemConfig".

I've updated TiddlyTools CoreTweaks to automatically make this change
to the window.ieCreatePath() function. (see tweak for ticket #749)

To add this tweak to your documents, install the latest update from
here:
http://www.TiddlyTools.com/#CoreTweaks

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

gigajosh

unread,
Sep 18, 2008, 5:24:52 AM9/18/08
to TiddlyWiki
Thanks - your fix sorted it out for me :)

kilucas

unread,
Oct 19, 2008, 9:31:26 AM10/19/08
to TiddlyWiki
I too am having this problem even with a 2.4.1 core and the CoreTweaks
imply that the necessary change has already been made in 2.4.1. So I
thought I'd look into the code change above but, while heeding the
warning to leave the core alone and modify a plugin instead, I wasn't
sure where this specific core function exists and hence which shadow
tiddler to check and modify if necessary. Which would it be please?

Thanks

Kevin

wolfgang

unread,
Oct 19, 2008, 6:39:09 PM10/19/08
to TiddlyWiki
Hi Kevin,

> warning to leave the core alone and modify a plugin instead, I wasn't
> sure where this specific core function exists and hence which shadow
> tiddler to check and modify if necessary. Which would it be please?
>

core function all exists in the TW file itself and you could see and
edit them - which is warned of - if you open your TW not in a browser
- but in an editor. There are no core functions in shadowed tiddlers.

Regards,

W.

kilucas

unread,
Oct 19, 2008, 8:30:17 PM10/19/08
to TiddlyWiki
Wolfgang

Thanks for the feedback.

Presumably this means I can't inspect the code for the fix via a
tiddler (though presumably I could dump the source and inspect that)
but I could still apply the fix via the custom plugin. Does that mean
that I just dump all the code above into a tiddler and tag it with
systemConfig?

I'm not at all clear whether there'd be additional code I'd need to
precede it with or end the tiddler with, never having created a plugin
other than by importing.

And feel free to warn me off if this approach is complex - I'm not
very technical and am only looking to see if there's a simple solution
within my reach, rather than a complex solution that demands a lot
more time in the TW documentation and forums.

It still seems odd that this problem persists in 2.4.1. I'll also see
what happens if I map a drive letter to the UNC path.

Meanwhile many thanks for your guidance as ever.

Kevin

wolfgang

unread,
Oct 20, 2008, 5:04:02 AM10/20/08
to TiddlyWiki
> > We'll look into this and hopefully provide a fix for the core.
>
> I've opened a ticket:http://trac.tiddlywiki.org/ticket/749
>
> I've updated TiddlyTools CoreTweaks to automatically make this change
> to the window.ieCreatePath() function. (see tweak for ticket #749)
>
> To add this tweak to your documents, install the latest update from
> here:
> http://www.TiddlyTools.com/#CoreTweaks

> I too am having this problem even with a 2.4.1 core and the CoreTweaks
> imply that the necessary change has already been made in 2.4.1.
> It still seems odd that this problem persists in 2.4.1.

You must have misread, CoreTweaks only writes:

Note: the changes contained in this tiddler are generally applicable
for the current version of TiddlyWiki (2.4.1).

- so they are still applicable and not obsolete at all.

I would recommend just to install CoreTweaks #749.

W.

kilucas

unread,
Oct 20, 2008, 2:49:33 PM10/20/08
to TiddlyWiki
Ah, yes, I misinterpreted this.

I'd also read "It is hoped that some of these tweaks may be
incorporated into later versions of the TW core" and saw that the core
version to which it applied was 2.2.0. So I assumed that these tweaks
would be present in 2.4.1.

I'll go back and follow the instructions this time! Thanks for the
clarification.

Kevin
Reply all
Reply to author
Forward
0 new messages