pub struct SteamConfig { /* private fields */ }
Expand description
Represents a copy of a Steam configuration file.
This struct only allows modification to the global Proton version to be used by Steam.
§Examples
The struct can be written to a file by using its Into
trait.
let path = Path::from("/some/path");
let steam_config = SteamConfig::create_copy(path).unwrap();
steam_config.set_proton_version("Proton-6.20-GE-1");
let steam_config: Vec<u8> = steam_config.into();
std::fs::write(path, steam_config).unwrap();
Implementations§
Source§impl SteamConfig
impl SteamConfig
Sourcepub fn create_copy(config_file_path: &Path) -> Result<Self, SteamConfigError>
pub fn create_copy(config_file_path: &Path) -> Result<Self, SteamConfigError>
Create a copy of a Steam config provided by path.
This method reads a global Steam configuration file 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 to make future modifications easier.
§Errors
This method will return an error in the following cases:
- When the default compatibility tool attribute could not be found
- When any filesystem operations return an IO error
Sourcepub fn proton_version(&self) -> String
pub fn proton_version(&self) -> String
Get the global Proton version stored in the Steam config file.
The “version” is actually the name of the directory that contains all the version data.
Sourcepub fn set_proton_version(&mut self, proton_dir_name: &str)
pub fn set_proton_version(&mut self, proton_dir_name: &str)
Set the global Proton version for this file copy.
The “version” is actually the name of the directory that contains all the version data.