aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils.vala
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--utils.vala14
1 files changed, 14 insertions, 0 deletions
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;