Skip to content

Commit

Permalink
ansible: search XDG directories for Remmina config (#3106)
Browse files Browse the repository at this point in the history
Current versions of Remmina uses XDG directories for its configuration
file and data directory.
  • Loading branch information
richardlau authored Dec 9, 2022
1 parent f14e2b7 commit c35bdd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion ansible/plugins/library/remmina_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright Node.js contributors. All rights reserved.
Expand Down Expand Up @@ -83,16 +83,27 @@ def remmina_get_secret(remmina_config):


def find_remmina():
# Snap packaged Remmina.
config = os.path.expanduser('~/snap/remmina/current/.config/remmina/remmina.pref')
target = os.path.expanduser('~/snap/remmina/current/.local/share/remmina')
if os.path.isfile(config) and os.path.isdir(target):
return (config, target)

# Flatpak packaged Remmina.
config = os.path.expanduser('~/.var/app/org.remmina.Remmina/config/remmina/remmina.pref')
target = os.path.expanduser('~/.var/app/org.remmina.Remmina/data/remmina')
if os.path.isfile(config) and os.path.isdir(target):
return (config, target)

# Current versions of Remmina follows XDG directories.
xdg_config_home = os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config'))
xdg_data_home = os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share'))
config = os.path.join(xdg_config_home, 'remmina/remmina.pref')
target = os.path.join(xdg_data_home, 'remmina')
if os.path.isfile(config) and os.path.isdir(target):
return (config, target)

# Older versions of Remmina.
config = os.path.expanduser('~/.remmina/remmina.pref')
target = os.path.expanduser('~/.remmina')
if os.path.isfile(config) and os.path.isdir(target):
Expand Down
2 changes: 1 addition & 1 deletion ansible/plugins/library/ssh_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright Node.js contributors. All rights reserved.
Expand Down

0 comments on commit c35bdd2

Please sign in to comment.