aboutsummaryrefslogtreecommitdiff
path: root/src/wine.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-12-12 14:38:29 +0100
committerJan200101 <sentrycraft123@gmail.com>2020-12-12 14:38:29 +0100
commitd535019d4d5c1023768fc385055aae6573b2ac69 (patch)
treecdf487faeb997ddb6b459ed53ee3671d3e2ba64c /src/wine.c
parent1d88aa80aae9f7aa8df58a54f7eea0f0d0e5541a (diff)
parent76b2d32ae37eb0009eefe58674e3b16843cbb995 (diff)
downloadpolecat-d535019d4d5c1023768fc385055aae6573b2ac69.tar.gz
polecat-d535019d4d5c1023768fc385055aae6573b2ac69.zip
Merge branch 'fish'
Diffstat (limited to 'src/wine.c')
-rw-r--r--src/wine.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wine.c b/src/wine.c
index ebeacec..f3ad72d 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)
@@ -279,6 +280,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));
@@ -338,7 +342,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]);
}