Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/src/locate_ndk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,17 @@ class NDKLocator {

/// Expands a path template with environment variables and glob patterns.
static List<FileSystemEntity> expandPath(String pathTemplate) {
final path = pathTemplate.replaceAll(
'\$HOME',
Platform.environment['HOME']!,
);
final homeDirectory = Platform.isWindows
? Platform.environment['USERPROFILE']?.replaceAll('\\', '/')
: Platform.environment['HOME'];

if (homeDirectory == null) {
throw Exception(
'Failed to find home directory. Please ensure that the HOME environment variable is set. On Windows, the USERPROFILE environment variable should be set instead.',
);
}

final path = pathTemplate.replaceAll('\$HOME', homeDirectory);
final glob = Glob(path);
final matches = glob.listSync();
return matches;
Expand Down