aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-12-12 14:38:05 +0100
committerJan200101 <sentrycraft123@gmail.com>2020-12-12 14:38:20 +0100
commit76b2d32ae37eb0009eefe58674e3b16843cbb995 (patch)
tree23359df1cded4cc51e16a2a9fb0acd70a4b2fa04
parent28dc82c923d369f156008167237583f725e90375 (diff)
downloadpolecat-76b2d32ae37eb0009eefe58674e3b16843cbb995.tar.gz
polecat-76b2d32ae37eb0009eefe58674e3b16843cbb995.zip
add fish env support
-rw-r--r--src/wine.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wine.c b/src/wine.c
index 39b63ed..5d7030b 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -21,6 +21,7 @@ const static struct Command wine_commands[] = {
{ .name = "run", .func = wine_run, .description = "run an installed wine version" },
{ .name = "list-installed", .func = wine_installed, .description = "list already installed wine versions" },
{ .name = "env", .func = wine_env, .description = "add wine to your PATH in a POSIX shell"},
+ { .name = "fish-env", .func = wine_env, .description = "add wine to your PATH in the fish shell"},
};
COMMAND_GROUP_FUNC(wine)
@@ -266,6 +267,9 @@ COMMAND(wine, env)
{
if (argc > 1)
{
+ // instead of creating redundant copies we just check for fish
+ bool fish_env = (strcmp(argv[0], "fish-env") == 0);
+
char winepath[PATH_MAX];
char* winebinloc = NULL; // to be set by the wine type check
getWineDir(winepath, sizeof(winepath));
@@ -325,7 +329,14 @@ COMMAND(wine, env)
}
else
{
- printf("PS1=\"(%s) $PS1\"\nPATH=\"%s:$PATH\"\n", winever, winepath);
+ if (!fish_env)
+ {
+ printf("PS1=\"(%s) $PS1\"\nPATH=\"%s:$PATH\"\n", winever, winepath);
+ }
+ else
+ {
+ printf("set PATH %s $PATH\n", winepath);
+ }
}
//printf("PATH=\"%s\"\n# Run this code in your Terminal\n# by running eval `%s`", newpath, argv[0]);
}