From b9162f395b930c73cb23b2847e9fef86b98217df Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Sun, 12 Apr 2020 14:26:41 +0200 Subject: Move get_shell to utils.vala There was no VTE-related functionality in this method, so we can find a better place for it now that a dedicated utility class exists. --- utils.vala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'utils.vala') diff --git a/utils.vala b/utils.vala index 845728b..0c5bd35 100644 --- a/utils.vala +++ b/utils.vala @@ -1,4 +1,18 @@ class Utils { + public static string get_shell() { + var env_shell = Environment.get_variable("SHELL"); + if (env_shell != null && env_shell.length > 0){ + return env_shell; + } + + unowned Posix.Passwd pw = Posix.getpwuid(Posix.getuid()); + if (pw != null && pw.pw_shell.length > 0) { + return pw.pw_shell; + } + + return "/bin/sh"; + } + public static string? normalize_uri(string? uri) { if (uri == null) return null; -- cgit v1.2.3-2-gb3c3