Created
September 1, 2020 23:35
-
-
Save iconifyit/b5c7c268915343152b4db3314c0054b3 to your computer and use it in GitHub Desktop.
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"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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