code: private static String replaceTildeWithHomeDir(String path) {
          if (path.startsWith("~/"))
              return System.getProperty("user.home") + path.substring(1);
          return path;
      }
docs: Utility for resolving paths on unix systems that contain tilda for
  the home directory.
  
  @param path the file system path
  @return normalised path