MMNotes.localURLToFilePath & MMNotes.filePathToLocalURL Workaround In The Dreamweaver Extensibility API

Dreamweaver Paths

If you have worked with the Dreamweaver Extensibility API, you may have noticed that the MMNotes.localURLToFilePath and MMNotes.filePathToLocalURL functions do not work correctly on Mac OS X.

Below is the code that I used to get around this issue:

function localURLToFilePath(localURL)
{
	return (dreamweaver.isOSX()) ? localURL.replace(/^file:\/\/\/([\d\w\s\\_-]+)(.+$)/, "/Volumes/$1$2") : MMNotes.localURLToFilePath(localURL);
}

function filePathToLocalURL(filePath)
{
	return (dreamweaver.isOSX()) ? "file://" + filePath : MMNotes.filePathToLocalURL(filePath);
}

Hope that saves you some time!

Tags: , , , , , , , , , , ,

Leave a Reply