Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Experimental switch to iterator based api #10

Conversation

CosmicHorrorDev
Copy link
Collaborator

Overall note: I'm planning on leaving the docs broken/outdated until all the large changes are done. No need to fix them just to have them break again with the next PR

This is an experimental look at a redesign around an iterator based API. The main aspects that changed are:

  • LibraryFolders is now represented by a Vec<Library> where each Library has its path and apps that it contains
  • Library::apps() returns an AppIter that iterates over each manifests and attempts to parse it
  • There is no longer an SteamDir::apps (I think I still want to provide this, just thinking on how to do it)
  • Switched a lot of things to private with public accessors

I added an overview example to show how the changes look. Here's the (modified) output of that for my laptop

Steam Dir - "$HOME/.steam/steam"
    Library - "$HOME/.data/Steam"
        App 677120 - Heroes of Hammerwatch
        App 1493710 - Proton Experimental
        App 620 - Portal 2
        App 477160 - Human: Fall Flat
        App 341800 - Keep Talking and Nobody Explodes
        App 1092790 - Inscryption
        App 440 - Team Fortress 2
        App 340 - Half-Life 2: Lost Coast
        App 400 - Portal
        App 70 - Half-Life
        App 1714040 - Super Auto Pets
        App 228980 - Steamworks Common Redistributables
        App 1274570 - DEVOUR
        App 457140 - Oxygen Not Included
        App 48000 - LIMBO
        App 398850 - Epistory - Typing Chronicles
        App 698640 - Deep Sky Derelicts
        App 628670 - Hellpoint
        App 246110 - MASSIVE CHALICE
        App 220 - Half-Life 2
        App 1391110 - Steam Linux Runtime - Soldier
        App 322330 - Don't Starve Together
        App 247080 - Crypt of the NecroDancer
        App 208750 - Apotheon
    Library - "/path/to/other/lib/temp steam lib"
        App 1794680 - Vampire Survivors
        App 4000 - Garry's Mod

That's all for now. Just figured I would put this up for some early feedback

@CosmicHorrorDev CosmicHorrorDev mentioned this pull request Apr 23, 2023
@CosmicHorrorDev CosmicHorrorDev changed the base branch from master to dev-v2.0 May 21, 2023 15:28
@CosmicHorrorDev CosmicHorrorDev marked this pull request as ready for review May 21, 2023 17:05
@CosmicHorrorDev CosmicHorrorDev merged commit 5e2c22b into WilliamVenner:dev-v2.0 May 21, 2023
CosmicHorrorDev added a commit to CosmicHorrorDev/steamlocate-rs that referenced this pull request Dec 30, 2023
* Hack together experimental API

* Get tests passing

* Dont use the apps listing from `libraryfolders.vdf`

* Fix windows build

* Remove caching of values

* Placate clippy
CosmicHorrorDev added a commit that referenced this pull request Feb 25, 2024
* Bump version

* Fully switch from `steamy-vdf` (#9)

* feat: Switch appmanifest parsing to use `keyvalues-serde`

* feat: Add example to showcase `SteamApp` struct changes

* chore: Remove lingering debug `println!()`

* fix: Switch some fields to optional

* feat: Add `dlcappid` and `LauncherPath` to manifest

* fix: Add more missing fields to `SteamApp`

* Parsing tweaks

* Expose `crate::steamapp` types

* Placate clippy

* Publish v2.0.0-alpha.0

* Experimental switch to iterator based api (#10)

* Hack together experimental API

* Get tests passing

* Dont use the apps listing from `libraryfolders.vdf`

* Fix windows build

* Remove caching of values

* Placate clippy

* Custom error type (#29)

* Add additional Steam search paths for Linux (#31)

* Add additional Steam search paths for Linux

* Fix invalid return type for locate_steam_dir

* Fix formatting-related CI fail

* impl std::error::Error for Error {} (#32)

* Remove steamid-ng feature (keep public API stable) (#33)

* Add Snap support for linux (#30)

* Get things back to compiling and passing (#38)

* Update dependencies (#39)

* `cargo upgrade`

* `cargo upgrade --incompatible`

Everything seems to work fine on my machine. We'll see if CI has
anything to say otherwise. We should really beef up our test suite too,
but now I'm rambling

* Switch tests to run in isolated dummy steam installations (#40)

* Switch tests to run in isolated dummy steam installations

* Placate clippy

* Drastically simplify test helpers (#41)

* Run `cargo test` in CI (#42)

* Run `cargo test` in CI

* `#[ignore]` a couple lingering doctests

* Placate clippy (#43)

* Placate clippy on more platforms (#44)

* Run CI on more platforms/channels (#45)

* Bundle existing CI jobs into one

* Run CI on more platforms

* Use `dtolnay/rust-toolchain` action

* Setup CI caching

* Run CI on stable and beta

* Error cleanup (#46)

* `ParseErrorInner` should **not** be part of the public API

* `LibaryFolders` -> `LibraryFolders`

* Make `Error` non-exhaustive

* Add path to io error

* Add path to parse error

* Remove erroneous print

* Fixup error for missing app installation

* Unfocused polish (#47)

* Refactor `StateFlags`

* Restructure public api

* `cargo fmt`

* Rework `locate()` failures (#49)

* Move unsupported OS failure to runtime

* Move `locate()` behind a feature flag

* Port compat tool (#50)

* add method to query configured compatibility tool

* Update things to better match new structure

---------

Co-authored-by: Jan200101 <sentrycraft123@gmail.com>

* Expose `Library::from_dir()` and `InstallDir::library_paths()` (#51)

* Expose `Library::from_dir()`

* Add a way to get just library paths

* Another round of refactors (#52)

* Rename `InstallDir` back to `SteamDir`

* `FlagIter` -> `StateFlagIter`

* `tests::test_helpers` -> `tests::helpers`

* Conditionally ignore `shortcuts_extras` test

* Provide more context on installation location failure (#53)

* Prepare another alpha (#54)

* Bump version to v2.0.0-alpha.1

* Make `App` plain data

* Docs overhaul (#55)

* Finally found an approach to doctest dependecies thats decent

* Overhaul landing page

* Make github syntax highlighting happy

* `cargo fmt`

* Overhaul all remaining existing docs

* `cargo fmt`

* Prepare the v2.0 beta release (#56)

* `SteamDir::from_steam_dir` -> `SteamDir::from_dir`

* `shortcuts_extra` is now just part of `steamlocate`

* Make `app_id` name more consistent

* `cargo fmt`

* Update the README

* Bump version to v2.0.0-beta.0

* Remove need to use `tempfile` (#57)

* Remove need to use `tempfile`

* Bump version to v2.0.0-beta.1

* Make `app.last_updated` actually optional (#59)

* Fix wasm32 in general (#60)

* Alias `lastupdated` for `last_updated` (#61)

* Add failing test

* Alias `last_updated` to `lastupdated` as well

* Bump version to v2.0.0-beta.2 (#62)

* Temporarily ignore broken test

---------

Co-authored-by: Ethan Green <ethangreen.dev@gmail.com>
Co-authored-by: Jan <sentrycraft123@gmail.com>
@CosmicHorrorDev CosmicHorrorDev deleted the switch-to-iterator-based-api branch January 26, 2025 20:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant