Skip to content

External Opener

Work in Progress

This guide is under development. Check back soon!

Overview

Hermes provides cross-platform methods to open URLs in the default browser, open files in their default applications, and reveal files in the native file manager.

Quick Reference

csharp
// Open a URL in the default browser
HermesApplication.OpenUrl("https://example.com");

// Open a file in its default application
HermesApplication.OpenFile("/path/to/document.pdf");

// Open a directory in the file manager
HermesApplication.OpenFile("/path/to/folder");

// Reveal a file in the file manager (Explorer, Finder, etc.)
HermesApplication.RevealInFileManager("/path/to/file.txt");

API

OpenUrl(string url)

Opens a URL in the default browser. Only http:// and https:// schemes are allowed.

csharp
HermesApplication.OpenUrl("https://docs.mythetech.com");

Throws ArgumentException if the URL uses a disallowed scheme.

OpenFile(string path)

Opens a file in its default application, or a directory in the native file manager.

csharp
HermesApplication.OpenFile("/path/to/image.png");   // Opens in image viewer
HermesApplication.OpenFile("/path/to/folder");        // Opens in Finder/Explorer

Throws FileNotFoundException if the path does not exist.

RevealInFileManager(string path)

Reveals a file or directory in the platform's native file manager.

csharp
HermesApplication.RevealInFileManager("/path/to/file.txt");
PlatformFile BehaviorDirectory Behavior
WindowsOpens Explorer with file selectedOpens Explorer to directory
macOSOpens Finder with file selectedOpens Finder to directory
LinuxOpens parent directory (no file selection)Opens directory

Coming Soon

  • Custom URL scheme support
  • Mailto support