resolvePlatformPath function
Implementation
Future<String> resolvePlatformPath(
String path, {
required bool isDirectory,
}) async {
final normalized = p.normalize(p.absolute(path));
final exists = isDirectory
? Directory(normalized).existsSync()
: File(normalized).existsSync();
if (!exists) return normalized;
try {
final resolved = isDirectory
? await Directory(normalized).resolveSymbolicLinks()
: await File(normalized).resolveSymbolicLinks();
return p.normalize(resolved);
} on FileSystemException {
// Picker and drop paths normally exist. Keep a lexical fallback for a
// file that disappears between selection and authorization.
return normalized;
}
}