Posts Tagged ‘localurl’

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

Wednesday, April 22nd, 2009

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!