title: Mac OS - Can I generate a clickable link to local file using relative path like “file:///~”
body: <p>In my company, we use Google Drive and often have to tell each other the path to a particular file. Paths are long as we use a lot of nested folders, so it's pretty boring and time consuming to browse through all that.</p>
  
  <p>Now, in my previous company, we used a central afp server, so the path was common to everyone, therefore I had created an applescript script that could get the absolute afp path to the file, people pasted that path in a mail or chat and the end user could click on that path which automatically became a link and the finder would open, selecting that particular file or folder that the link led to.</p>
  
  <p>The reason I can't use the exact same script is that Google Drive folder is in the user home folder. So if user's name is Foo the path will be <code>file:///Users/Foo/Google Drive</code>, while for user Bar the path will be <code>file:///Users/Bar/Google Drive</code></p>
  
  <p>Clearly the path generated from user Foo won't work for user Bar</p>
  
  <p>Since, at least in the terminal, the path to <code>file:///Users/username</code> equals to <code>~</code>, I made my script generate links like <code>file:///~/Google Drive/pathToFolder</code>, but they do not work :( Clicking on such a link will open the finder, but won't select the right file or folder</p>
  
  <p>This is driving me crazy because it looks like it should work but it simply doesn't... is there any other syntax I should try? Any suggestion?</p>