pub struct LutrisConfig { /* private fields */ }
Expand description
Represents a copy of the global Lutris config file
This struct only provides functionality for reading and setting the global Wine version to use in Lutris.
§Examples
The struct can be written to a file by using its Into
trait.
let path = Path::from("/some/path");
let lutris_config = LutrisConfig::create_copy(path).unwrap();
lutris_config.set_proton_version("Proton-6.20-GE-1");
let lutris_config: Vec<u8> = lutris_config.into();
std::fs::write(path, lutris_config).unwrap();
Implementations§
Source§impl LutrisConfig
impl LutrisConfig
Sourcepub fn create_copy(config_file_path: &Path) -> Result<Self, LutrisConfigError>
pub fn create_copy(config_file_path: &Path) -> Result<Self, LutrisConfigError>
Create a copy of a Lutris config provided by path.
This method reads the global Wine configuration file of Lutris and creates a copy of it by reading it line by line. While reading each line the following information is determined:
- The line that contains the default compatibility tool directory name (dir_name_line)
- The index of the dir_name_line
- The index where the value of dir_name_line begins
- The index where the value of dir_name_line ends
This above information is stored make future modifications easier.
§Errors
- When the default compatibility tool attribute could not be found
- When any filesystem operations return an IO error
Sourcepub fn set_wine_version(&mut self, wine_directory_name: &str)
pub fn set_wine_version(&mut self, wine_directory_name: &str)
Set the global Wine version for this file copy.
The “version” is actually the name of the directory that contains all the version data.
Sourcepub fn wine_version(&self) -> String
pub fn wine_version(&self) -> String
Get the global Wine version stored in global Wine config for Lutris.
The “version” is actually the name of the directory that contains all the version data.