public static String expandUserHomeDirectory(String fileName){
  if (fileName.startsWith("~") && (fileName.length() == 1 || fileName.startsWith("~/"))) {
    String userDir=SysProperties.USER_HOME;
    fileName=userDir + fileName.substring(1);
  }
  return fileName;
}

public static String expandUserHomeDirectory ( String fileName ) { if ( fileName . startsWith ( "~" ) && ( fileName . length ( ) == 1 || fileName . startsWith ( "~/" ) ) ) { String userDir = SysProperties . USER_HOME ; fileName = userDir + fileName . substring ( 1 ) ; } return fileName ; }
expand ' ~ ' to the user home directory . it is only be expanded if the ' ~ ' stands alone , or is followed by ' / ' or ' \ ' .
