loadorder/
lib.rs

1/*
2 * This file is part of libloadorder
3 *
4 * Copyright (C) 2017 Oliver Hamlet
5 *
6 * libloadorder is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * libloadorder is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with libloadorder. If not, see <http://www.gnu.org/licenses/>.
18 */
19// Deny some rustc lints that are allow-by-default.
20#![deny(
21    ambiguous_negative_literals,
22    impl_trait_overcaptures,
23    let_underscore_drop,
24    missing_copy_implementations,
25    missing_debug_implementations,
26    non_ascii_idents,
27    redundant_imports,
28    redundant_lifetimes,
29    trivial_casts,
30    trivial_numeric_casts,
31    unit_bindings,
32    unreachable_pub,
33    unsafe_code
34)]
35#![deny(clippy::pedantic)]
36// Allow a few clippy pedantic lints.
37#![allow(clippy::doc_markdown)]
38#![allow(clippy::must_use_candidate)]
39#![allow(clippy::missing_errors_doc)]
40// Selectively deny clippy restriction lints.
41#![deny(
42    clippy::allow_attributes,
43    clippy::as_conversions,
44    clippy::as_underscore,
45    clippy::assertions_on_result_states,
46    clippy::big_endian_bytes,
47    clippy::cfg_not_test,
48    clippy::clone_on_ref_ptr,
49    clippy::create_dir,
50    clippy::dbg_macro,
51    clippy::decimal_literal_representation,
52    clippy::default_numeric_fallback,
53    clippy::doc_include_without_cfg,
54    clippy::empty_drop,
55    clippy::error_impl_error,
56    clippy::exit,
57    clippy::exhaustive_enums,
58    clippy::expect_used,
59    // clippy::filetype_is_file,
60    clippy::float_cmp_const,
61    clippy::fn_to_numeric_cast_any,
62    clippy::get_unwrap,
63    clippy::host_endian_bytes,
64    clippy::if_then_some_else_none,
65    clippy::indexing_slicing,
66    clippy::infinite_loop,
67    clippy::integer_division,
68    clippy::integer_division_remainder_used,
69    clippy::iter_over_hash_type,
70    clippy::let_underscore_must_use,
71    clippy::lossy_float_literal,
72    clippy::map_err_ignore,
73    clippy::map_with_unused_argument_over_ranges,
74    clippy::mem_forget,
75    clippy::missing_assert_message,
76    clippy::missing_asserts_for_indexing,
77    clippy::mixed_read_write_in_expression,
78    clippy::multiple_inherent_impl,
79    clippy::multiple_unsafe_ops_per_block,
80    clippy::mutex_atomic,
81    clippy::mutex_integer,
82    clippy::needless_raw_strings,
83    clippy::non_ascii_literal,
84    clippy::non_zero_suggestions,
85    clippy::panic,
86    clippy::panic_in_result_fn,
87    clippy::partial_pub_fields,
88    clippy::pathbuf_init_then_push,
89    clippy::precedence_bits,
90    clippy::print_stderr,
91    clippy::print_stdout,
92    clippy::rc_buffer,
93    clippy::rc_mutex,
94    clippy::redundant_type_annotations,
95    clippy::ref_patterns,
96    clippy::rest_pat_in_fully_bound_structs,
97    clippy::str_to_string,
98    clippy::string_lit_chars_any,
99    clippy::string_slice,
100    clippy::string_to_string,
101    clippy::suspicious_xor_used_as_pow,
102    clippy::tests_outside_test_module,
103    clippy::todo,
104    clippy::try_err,
105    clippy::undocumented_unsafe_blocks,
106    clippy::unimplemented,
107    clippy::unnecessary_safety_comment,
108    clippy::unneeded_field_pattern,
109    clippy::unreachable,
110    clippy::unused_result_ok,
111    clippy::unwrap_in_result,
112    clippy::unwrap_used,
113    clippy::use_debug,
114    clippy::verbose_file_reads,
115)]
116#![cfg_attr(
117    test,
118    allow(
119        clippy::assertions_on_result_states,
120        clippy::indexing_slicing,
121        clippy::panic,
122        clippy::unwrap_used,
123    )
124)]
125
126mod enums;
127mod game_settings;
128mod ghostable_path;
129mod ini;
130mod load_order;
131mod openmw_config;
132mod plugin;
133#[cfg(test)]
134mod tests;
135
136pub use crate::enums::{Error, GameId, LoadOrderMethod};
137pub use crate::game_settings::GameSettings;
138pub use crate::load_order::{ReadableLoadOrder, WritableLoadOrder};
139
140fn is_enderal(game_path: &std::path::Path) -> bool {
141    game_path.join("Enderal Launcher.exe").exists()
142}