private static String sanitizePath(String rawPath) {
    if (rawPath == null) {
      return null;
    }
    return rawPath.replaceFirst("^~", System.getProperty("user.home"));
  }
Ensures a usable file path when the user specifies a tilde for the home path.

@param rawPath the original path.
@return        the updated path with the tilde resolved to home.
samza-rest/src/main/java/org/apache/samza/rest/resources/BaseResourceConfig.java