exists method

  1. @override
bool exists(
  1. String path
)
override

Checks if a file or directory exists at the specified path.

Implementation

@override
bool exists(String path) {
  try {
    final fullPath = resolvePath(path);
    print("Checking existence of: $fullPath");
    if (fullPath == rootDirectory) return true; // Virtual root always exists
    // Check both file and directory existence for the resolved physical path
    return File(fullPath).existsSync() || Directory(fullPath).existsSync();
  } catch (e) {
    // If resolvePath throws (e.g., invalid virtual path), it doesn't exist
    return false;
  }
}