File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ pub struct SystemProperties {
2727 pub engine_version : String ,
2828}
2929
30+ #[ cfg( target_os = "linux" ) ]
31+ fn is_flatpak ( ) -> bool {
32+ use std:: env:: var;
33+ var ( "FLATPAK_ID" ) . is_ok ( )
34+ || var ( "container" )
35+ . map ( |x| x. to_lowercase ( ) . trim ( ) == "flatpak" )
36+ . unwrap_or ( false )
37+ }
38+
3039pub fn get_info ( ) -> SystemProperties {
3140 let info = os_info:: get ( ) ;
3241 let locale = sys_locale:: get_locale ( ) . unwrap_or_default ( ) ;
@@ -35,7 +44,8 @@ pub fn get_info() -> SystemProperties {
3544 let os_name = match info. os_type ( ) {
3645 os_info:: Type :: Macos => "macOS" . to_string ( ) ,
3746 os_info:: Type :: Windows => "Windows" . to_string ( ) ,
38- _ if std:: env:: var ( "container" ) . is_ok ( ) => "Flatpak" . to_string ( ) ,
47+ #[ cfg( target_os = "linux" ) ]
48+ _ if is_flatpak ( ) => "Flatpak" . to_string ( ) ,
3949 _ => info. os_type ( ) . to_string ( ) ,
4050 } ;
4151
You can’t perform that action at this time.
0 commit comments