TiddlyWiki.org

Ticket #39 (closed defect: fixed)

Opened 2 years ago

Last modified 9 months ago

IE error when saving backups

Reported by: anonymous Assigned to: MartinBudden
Priority: major Milestone: 2.3
Component: core Version:
Severity: critical Keywords:
Cc:

Description

If a user specifies a backup folder initially and later moves their TW, IE 6 and IE 7 beta 2 give an error message when they try to save changes:

Error A Runtime Error has occured. Do you wish to Debug?

Line 3677 Error: Path not found

If the user manually creates the new backup folder, IE will save to it.

Using TW version 2.0.10. This error does not occur with FF 1.5.0.3.

See this thread.

Attachments

ticket39.patch (1.3 kB) - added by MartinBudden on 08/11/07 15:14:44.

Change History

26/05/06 00:44:11 changed by UdoBorkowski

To save the Backup file on IE the FileSystemObject? function OpenTextFile? is used. It looks like this function will not create the text file (even if the create flag is set) if the directory for that file does not exist (i.e. it does not create missing directories in the path for the text file).

I haven't found that behaviour documented explicitly but I recall it from working with Windows file system functions some time ago. You can verify this issue by manually defining the "missing" backup directory. In that case the backup is saved without an error.

A possible solution: in the function getBackupPath not only build the path (string) but also check if the directory exists and create it if not. For IE you can call FileSystemObject?.CreateFolder? for this purpose. Notice that CreateFolder? also requires that the folder containing the new folder already exists, i.e. the backup folder must be in a folder that already exists.

(BTW: According to my tests "moving" the TW (as reported in the initial post) is not necessary to produce the error. Just define/change the backup path in the advanced options, check "save changes" and save and you will run into the error. I assume that the "backup into a separate backup directory" feature never worked on IE (unless the backup directory wasn't created manually))

26/05/06 15:38:54 changed by gkw

It should walk up the path using GetParentFolderName?(path) until it finds a directory that does exist (FolderExists?(path)) and then flesh out the structure.

I use an alternate backup folder on IE, but then I created the folder first ....

function ieCreatePath(path) {

try

{ var fso = new ActiveXObject("Scripting.FileSystemObject?"); }

catch(e)

{ //alert("Exception while attempting to create path\n\n" + e.toString()); return(null); }

// Remove the filename, if present. Use trailing slash (i.e. "foo\bar\") if no filename. var pos = path.lastIndexOf("\\"); if (pos!=-1) path = path.substring(0, pos+1);

// Walk up the path until we find a folder that exists var scan = []; scan.push(path); var i=0; do {

var parent = fso.GetParentFolderName?(scan[i++]); if (fso.FolderExists?(parent))

break;

scan.push(parent);

} while (true); // Walk back down the path, creating folders for (i=scan.length-1;i>=0;i--) {

if (!fso.FolderExists?(scan[i]))

fso.CreateFolder?(scan[i]);

}

}

26/05/06 16:02:47 changed by gkw

Wow ... trac really butchered that ....

function ieCreatePath(path)
{
	try
		{
		var fso = new ActiveXObject("Scripting.FileSystemObject");
		}
	catch(e)
		{
		//alert("Exception while attempting to create path\n\n" + e.toString());
		return(null);
		}

	// Remove the filename, if present.  Use trailing slash (i.e. "foo\bar\") if no filename.
	var pos = path.lastIndexOf("\\");
	if (pos!=-1) path = path.substring(0, pos+1);

	// Walk up the path until we find a folder that exists
	var scan = [];
	scan.push(path);
	var i=0;
	do
	{
		var parent = fso.GetParentFolderName(scan[i++]);
		if (fso.FolderExists(parent))
			break;
		scan.push(parent);
	} while (true);
	// Walk back down the path, creating folders
	for (i=scan.length-1;i>=0;i--)
	{
		if (!fso.FolderExists(scan[i]))
			fso.CreateFolder(scan[i]);
	}
}

10/07/06 11:24:17 changed by JeremyRuston

  • status changed from new to assigned.
  • milestone set to 2.1.

06/10/06 14:29:52 changed by JeremyRuston

  • priority changed from minor to critical.
  • milestone changed from 2.1 to 2.2.

06/10/06 14:30:03 changed by JeremyRuston

  • severity changed from low to critical.

11/10/06 20:17:51 changed by JeremyRuston

  • priority changed from critical to minor.

21/12/06 22:20:25 changed by MartinBudden

  • owner deleted.
  • status changed from assigned to new.

21/12/06 22:20:55 changed by MartinBudden

  • milestone changed from 2.2 to 2.3.

08/11/07 15:14:44 changed by MartinBudden

  • attachment ticket39.patch added.

08/11/07 15:15:12 changed by MartinBudden

  • owner set to MartinBudden.
  • status changed from new to assigned.

08/11/07 15:16:11 changed by MartinBudden

  • priority changed from minor to major.

12/11/07 10:13:36 changed by JeremyRuston

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed in changeset:2804