Skip to content

Use FileExtensionHelpers more widely #10831

Closed
@QuaintMako

Description

@QuaintMako

Description

We are often in need of identifying an item's type, whether it be folder, file, images or anything really.

Currently, we have rogue tests to do this work for us repeated separately in the code. For example when it comes to identify shortcuts :

OpenPath(...) in NavigationHelpers:
path.EndsWith(".lnk", StringComparison.Ordinal) || path.EndsWith(".url", StringComparison.Ordinal);

ToStorageItem(...) in StorageHelpers
if (path.EndsWith(".lnk", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".url", StringComparison.OrdinalIgnoreCase))

FileExtensionHelpers.cs defines a bunch of methods that are cattled to such ends. We should enrich it and make its use wider.

Concerned code

All the codebase.

Gains

  • Reduction of duplication.
  • Regrouping of same logic inside a given class

Requirements

  • FileExtensionHelpers.cs used more when identifying item's type.

Comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions