GithubHelp home page GithubHelp logo

lukaslichten / proton-finder Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19 KB

Rust cross platform library for finding and pathing through proton prefixes

License: MIT License

Rust 100.00%
proton steam wrapper wine

proton-finder's Introduction

Proton-Finder

Rust library for finding and working with steams proton prefixes, and accessing common paths within them.
Additionally providing a universal wrapper to allow one codebase for Windows and Linux support.

Purpose

Primary use case is for developing cross plattform modding tools/save file editors.
A lot of games save their save files/load mods from the AppData or Documents folders under Windows (which under Windows are easily accessible with libraries such as dirs).
When running under Linux + Proton (or Wine) these folders are stored within the prefix, and therefore harder to access.

So this library provides functions to allow abstracting these prefixes away, so you can access the same folders on Windows and Linux through universal functions.

Additional linux modul is available when the target_os is Linux, which allows rawer access,
including allow also opening wine prefixes and reading .reg Registry files from the prefix.

Example

let res = proton-finder::get_game_drive(2420510).map_or_else(|e| {
    println!("Steam Dir provided is not correctly formated, ignored...");
    e
}, |k| k);

if let Some(game_drive) = res {
    if let Some(mut path) = game_drive.config_local_dir() {
        path.push("HoloCure");
        path.push("settings.json");

        if let Ok(text) = std::fs::read_to_string(path) {
            println!("{}", text);
        }
    }
} else {
    println!("Unable to find game drive. Did you install the game?");
}

This reads the settings.json for the game HoloCure

Steam root folder priority

Per default, if the env value $STEAM_DIR (same as Protontricks) it will use this as the first steam root to search.
You can disable the automatic reading of the env with the no_tricks features.

This is followed by checking:
~/.steam/steam
~/.local/share/Steam
~/.var/app/com.valvesoftware.Steam/data/Steam/ (Flatpak)

Testing

Requires Steam and HoloCure (free game) installed (and launched the game at least once).

proton-finder's People

Contributors

lukaslichten avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.