diff --git a/source/libublsettings.c b/source/libublsettings.c index 539ae78..0c31352 100644 --- a/source/libublsettings.c +++ b/source/libublsettings.c @@ -169,4 +169,17 @@ int yon_launch_app_with_arguments(char *name, char *args) void yon_launch(char *command) { int ansver = system(command); +} + +#define os_name_get_command "sed -En 's/^PRETTY_NAME=[\"]*([^\"]+)[\"]*/\\1/p' /etc/os-release" +char *yon_ubl_get_os_name(){ + char *os_name = NULL; + int size; + config_str ret = yon_config_load(os_name_get_command,&size); + if (size){ + yon_char_remove_last_symbol(ret[0],'\n'); + os_name = yon_char_new(ret[0]); + yon_char_parsed_free(ret,size); + } + return os_name; } \ No newline at end of file diff --git a/source/libublsettings.h b/source/libublsettings.h index 4bdc957..b82dbf6 100644 --- a/source/libublsettings.h +++ b/source/libublsettings.h @@ -1693,6 +1693,10 @@ int yon_launch_app_with_arguments(char *command, char *args); /// @param command Command to execute void yon_launch(char *command); +/// @brief Get cuurent OS name +/// @return Newly allocated string or NULL +char *yon_ubl_get_os_name(); + // // Trash collector functions // int yon_trash_collector_append(void *pointer, char group_key);