Skip to content

Prefer Windows Specific Path for Storing Configuration File #470

@catuhana

Description

@catuhana

The Problem

Currently, ferium uses ~/.config path on all platforms, which resolves to C:\Users\<User>\.config on Windows. Even though this path is used popularly for Windows apps, a Windows standard way should be preferred.

Why?

Most launchers already use platform specific paths, and it's nicer to use them.

Your Solution(s)

Use FOLDERID_RoamingAppData or FOLDERID_LocalAppData (aka %APPDATA% or %LOCALAPPDATA respectively) for Windows. We can do this in 3 ways:

  1. Just append \AppData\Roaming\ to libium::HOME. This is the simplest way, but for reasons, Windows recommends using FOLDERIDs directly (which is why two the two other solutions below).
  2. Use sys-traits crate's EnvCacheDir::env_cache_dir (which what Deno uses)
    • The issue with this is, this crate only supports FOLDERID_LocalAppData, which is not a bad thing, but FOLDERID_RoamingAppData is more favourable to use.
  3. Use windows-rs directly
    • Since this will be a Windows only implementation, a manual simple implementation could be done, similar to cargo's code.

For testing, I've created a branch using the first solution, and everything works so far. If this is going to be considered, I can create a PR directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in sourceFixed in-source, but not released yet

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions