Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixes a bug in Adobe CEP where CEP confuses connected drives with local folders when the relative paths are the same. For instance "/Volumes/Users/username" and "/Users/username"
/**
* Bug fix for the issue described at the link below.
* @link https://community.adobe.com/t5/indesign/extendscript-oddity-with-file-folder-on-mac-os-x/m-p/3887816?page=1#M165105
*/
function fixVolumePathBug(filepath) {
if ($.os.toLowerCase().indexOf('mac') === -1) return filepath;
var $HOME = new Folder('~/').fsName;
if (filepath.indexOf($HOME) > 0) {
var parts = filepath.split($HOME);
filepath = $HOME + '/' + parts.pop();
}
return filepath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.