DesktopFileType record

Namespace Runic.Platform in Runic.Platform 0.23.0

public sealed record DesktopFileType : IEquatable<DesktopFileType>

Inherits or implements IEquatable.

A file type the application opens, which IDesktopOpenRegistration registers.

Parameters

Extension

The file name extension with its dot, such as .notes; compared without regard to case.

Exceptions

ArgumentException

The extension does not start with one dot, ends with a dot, or contains a path separator, a wildcard, white space or a control character.

Constructors

DesktopFileType

public DesktopFileType(string Extension)

A file type the application opens, which IDesktopOpenRegistration registers.

Parameters

Extension

The file name extension with its dot, such as .notes; compared without regard to case.

Exceptions

ArgumentException

The extension does not start with one dot, ends with a dot, or contains a path separator, a wildcard, white space or a control character.

Properties

Description

public string? Description { get; init; }

The name the shell shows for the type, such as Notes document; null by default.

Exceptions

ArgumentException

The value is empty or contains a control character.

Extension

public string Extension { get; init; }

The file name extension with its dot, such as .notes.

IconPath

public string? IconPath { get; init; }

The icon for files of the type: on Windows a fully qualified .ico or executable path, optionally with ,index (DefaultIcon); on Linux an icon name or fully qualified path. null by default, for the application's icon. macOS takes icons from the bundle and ignores it.

Exceptions

ArgumentException

The value is empty or contains a quote or a control character.

MimeType

public string? MimeType { get; init; }

The MIME type of the files, such as application/x-example-notes; null by default.

Exceptions

ArgumentException

The value is not type/subtype made of MIME token characters.

Remarks

Linux associates the desktop entry with this type and, for a type the shared MIME-info database does not know, writes its definition with the extension's glob. Without it, Linux uses the type the database gives the extension and fails with PlatformFailureCode.InvalidData when it gives none. Windows and macOS ignore it.