1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! [](https://docs.rs/lib_game_detector)
//! [](https://crates.io/crates/lib_game_detector)
//! [](https://crates.io/crates/lib_game_detector)
//! [](https://deps.rs/repo/github/Rolv-Apneseth/lib_game_detector)
//! [](https://github.com/Rolv-Apneseth/lib_game_detector/blob/main/LICENSE)
//!
//! A Rust library for detecting and parsing data about games installed on the system. Currently
//! only supports Linux.
//!
//! # Description
//!
//! This is a Rust library intended to be used for programs which need information on currently
//! installed games, such as a games launcher, or mod manager. It can provide information such as
//! what games are installed across multiple launchers (such as Steam and Heroic Games Launcher),
//! where those games are installed, what command will launch them, and more.
//!
//! # Quick start
//!
//! Install with:
//!
//! ```sh
//! cargo add lib_game_detector
//! ```
//!
//! Support for serialization via `serde`, which is enabled by default, can be disabled
//! by installing with:
//!
//! ```sh
//! cargo add lib_game_detector --no-default-features
//! ```
//!
//! Support for Itch requires `rusqlite` to read an `sqlite` database file. The `bundled` feature
//! (to include a bundled version of `sqlite`) is disabled by default, but can be enabled by
//! installing with:
//!
//! ```sh
//! cargo add lib_game_detector --features bundled_sqlite
//! ```
//!
//! # Usage
//!
//! ```rust
//! use lib_game_detector::{data::SupportedLaunchers, get_detector};
//!
//! let detector = get_detector();
//! let detected_launchers = detector.get_detected_launchers();
//! let all_games = detector.get_all_detected_games();
//! let all_games_by_launcher = detector.get_all_detected_games_per_launcher();
//! let all_games_from_steam = detector.get_all_detected_games_from_specific_launcher(SupportedLaunchers::Steam);
//! ```
//!
//! # Examples
//!
//! - Checkout [rofi-games](https://github.com/Rolv-Apneseth/rofi-games) or [rgd](https://github.com/Rolv-Apneseth/rgd)
//! to see this library being used to find games and their box art for displaying in a launcher
//! - Check the [examples folder](https://github.com/Rolv-Apneseth/lib_game_detector/tree/main/examples)
//!
//! # Currently supported game sources
//!
//! - Steam
//! - Non-Steam games added as shortcuts are also supported. Just make sure to launch newly added
//! shortcuts through Steam at at least once for them to be detected correctly (some files need
//! to be generated).
//! - Heroic Games Launcher (Legendary, Nile, GOG, and manually added games)
//! - Lutris
//! - Bottles
//! - Only lists entries included in the Library
//! - Modded Minecraft (Prism Launcher, ATLauncher)
//! - Titles are given as `Minecraft - {instance name}`
//! - Itch ([itch.io](https://itch.io) app)
use cfg_if;
use GamesDetector;
cfg_if!
/// Primary entry point into the crate - get a [`GamesDetector`]
// TODO: use [macro_files](https://github.com/MathieuTricoire/macro_files) to reduce size of repo
// and more importantly to have clear definitions of expected file structures for each test. All
// the example game files will still need to be included so as to not clutter the code though.