mirror of
https://github.com/clearlinux/linux-steam-integration.git
synced 2026-09-07 14:21:48 +00:00
Implement the store function, we'll need it for a UI
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This commit is contained in:
@@ -151,6 +151,41 @@ bool lsi_config_load(LsiConfig *config)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline const char *lsi_bool_to_string(bool b)
|
||||
{
|
||||
if (b) {
|
||||
return "true";
|
||||
}
|
||||
return "false";
|
||||
}
|
||||
|
||||
bool lsi_config_store(LsiConfig *config)
|
||||
{
|
||||
autofree(FILE) *fp = NULL;
|
||||
autofree(char) *conf = NULL;
|
||||
|
||||
if (!config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
conf = lsi_get_user_config_file();
|
||||
if (!conf) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fp = fopen(conf, "w");
|
||||
if (!fp) {
|
||||
return false;
|
||||
}
|
||||
if (fprintf(fp,
|
||||
"[Steam]\nuse-native-runtime = %s\nforce-32bit = %s\n",
|
||||
lsi_bool_to_string(config->use_native_runtime),
|
||||
lsi_bool_to_string(config->force_32)) < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void lsi_config_load_defaults(LsiConfig *config)
|
||||
{
|
||||
assert(config != NULL);
|
||||
|
||||
@@ -44,6 +44,13 @@ bool lsi_config_load(LsiConfig *config);
|
||||
*/
|
||||
void lsi_config_load_defaults(LsiConfig *config);
|
||||
|
||||
/**
|
||||
* Attempt to write the user config to disk.
|
||||
* On failure, this function will return false, and errno will be set
|
||||
* appropriately.
|
||||
*/
|
||||
bool lsi_config_store(LsiConfig *config);
|
||||
|
||||
/**
|
||||
* Determine if the host system is 64-bit.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user