Skip to content

Commit

Permalink
Rename some far2m's environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Jan 9, 2025
1 parent ae78405 commit 1ffca76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions WinPort/src/Backend/WinPortMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ static std::string GetStdPath(const char *env1, const char *env2)

static void SetupStdHandles()
{
const std::string &out = GetStdPath("FAR_STDOUT", "FAR_STD");
const std::string &err = GetStdPath("FAR_STDERR", "FAR_STD");
const std::string &out = GetStdPath("FAR2M_STDOUT", "FAR2M_STD");
const std::string &err = GetStdPath("FAR2M_STDERR", "FAR2M_STD");
unsigned char reopened = 0;
if (!out.empty() && out != "-") {
if (freopen(out.c_str(), "a", stdout)) {
Expand Down Expand Up @@ -249,8 +249,8 @@ extern "C" void WinPortHelp()
"\t--nomaximize - dont maximize window upon launch even if its has saved maximized state (only for GUI backend)\n"
"\t--clipboard=SCRIPT - use external clipboard handler script that implements get/set text clipboard data via its stdin/stdout\n"
"\n"
"All options also can be set via the FAR_ARGS environment variable\n"
" (for example: export FAR_ARGS=\"--tty\" to start far2m in tty mode by default)\n");
"All options also can be set via the FAR2M_ARGS environment variable\n"
" (for example: export FAR2M_ARGS=\"--tty\" to start far2m in tty mode by default)\n");
}

struct ArgOptions
Expand Down Expand Up @@ -368,7 +368,7 @@ extern "C" int WinPortMain(const char *full_exe_path, int argc, char **argv, int
}
#endif

char *ea = getenv("FAR_ARGS");
char *ea = getenv("FAR2M_ARGS");
if (ea != nullptr && *ea) {
std::string str;
for (const char *begin = ea;;) {
Expand All @@ -393,7 +393,7 @@ extern "C" int WinPortMain(const char *full_exe_path, int argc, char **argv, int
//const char *xdg_st = getenv("XDG_SESSION_TYPE");
//bool on_wayland = ((xdg_st && strcasecmp(xdg_st, "wayland") == 0) || getenv("WAYLAND_DISPLAY"));
if (arg_opts.x11) {
//if (((on_wayland && getenv("WSL_DISTRO_NAME")) && !arg_opts.wayland && !getenv("FAR_WSL_NATIVE")) || arg_opts.x11) {
//if (((on_wayland && getenv("WSL_DISTRO_NAME")) && !arg_opts.wayland && !getenv("FAR2M_WSL_NATIVE")) || arg_opts.x11) {
// on wslg stay on x11 by default until remaining upstream wayland-related clipboard bug is fixed
// https://github.com/microsoft/wslg/issues/1216
setenv("GDK_BACKEND", "x11", TRUE);
Expand Down Expand Up @@ -482,7 +482,7 @@ extern "C" int WinPortMain(const char *full_exe_path, int argc, char **argv, int

bool wsl_clipboard_workaround = (arg_opts.ext_clipboard.empty()
&& getenv("WSL_DISTRO_NAME")
&& !getenv("FAR_WSL_NATIVE"));
&& !getenv("FAR2M_WSL_NATIVE"));
if (wsl_clipboard_workaround) {
arg_opts.ext_clipboard = full_exe_path;
if (TranslateInstallPath_Bin2Share(arg_opts.ext_clipboard)) {
Expand Down
2 changes: 1 addition & 1 deletion luafar/lua_share/far2/far_about.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local function FarAbout()
Add(0, "OEM and ANSI codepages", win.GetOEMCP() ..", ".. win.GetACP())
AddEnv("FARHOME", 0)
AddEnv("FARSETTINGS", 0)
AddEnv("FAR_ARGS", 0)
AddEnv("FAR2M_ARGS", 0)
Add(0, "Config directory", far.InMyConfig())
Add(0, "Cache directory", far.InMyCache())
Add(0, "Temp directory", far.InMyTemp())
Expand Down

0 comments on commit 1ffca76

Please sign in to comment.