getDisplayPath function

String getDisplayPath(
  1. String filePath
)

Get display path (shorten home dir to ~).

Implementation

String getDisplayPath(String filePath) {
  final homeDir = Platform.environment['HOME'] ?? '';
  if (filePath.startsWith(homeDir)) {
    return '~${filePath.substring(homeDir.length)}';
  }
  return filePath;
}