summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxaizek <xaizek@posteo.net>2024-04-20 12:17:13 +0300
committerxaizek <xaizek@posteo.net>2024-04-20 15:31:37 +0300
commitcf238ebe94ba2e0665a9ff01bd78f3071f6b928a (patch)
tree581eb98d71837bd44e0bd8a5987d4ecb80850762
parentf9dd57e800df1784e1be109ad20b07bfa053837b (diff)
Fix vifm.exe using `data/vifmrc` as global config
This is a side-effect of "cleverly" using `data/` as both global config and application data directory on Windows to simplify handling of global color schemes. It's a bad idea because `vifmrc` file in each of those locations is used differently and results in sample configuration persisting despite user's attempts to change it in a copy of the sample vifmrc created in a different location. Thanks to midrare. See https://github.com/vifm/vifm/issues/993#issuecomment-2060237007
-rw-r--r--ChangeLog3
-rwxr-xr-xscripts/deploy3
-rw-r--r--src/utils/utils_win.c8
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d0a668c5f..2f19aa01d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -247,6 +247,9 @@
string which is present when errors are aggregated at the end of an
operation. Thanks to an anonymous at Vifm Q2A site.
+ Fixed `data/vifmrc` next to vifm.exe being used as global vifmrc file on
+ Windows. Thanks to midrare.
+
0.13-beta to 0.13 (2023-04-04)
Made "withicase" and "withrcase" affect how files are sorted before
diff --git a/scripts/deploy b/scripts/deploy
index 7c3647202..96a661e91 100755
--- a/scripts/deploy
+++ b/scripts/deploy
@@ -143,9 +143,12 @@ if [ "$target" = all ] || [ "$target" = archive ]; then
mkdir "$dir"
cp -R data "$dir"
+ # place colors to a pseudo-/etc directory in data/ after updating EOLs
for i in "$dir/data/colors"/*; do
unix2dos -c ISO "$i"
done
+ mkdir "$dir/data/etc"
+ mv "$dir/data/colors" "$dir/data/etc"
# remove Unix-specific files from data/
rm "$dir/data"/*.desktop
diff --git a/src/utils/utils_win.c b/src/utils/utils_win.c
index 0fbb0cb70..4123f0d88 100644
--- a/src/utils/utils_win.c
+++ b/src/utils/utils_win.c
@@ -942,7 +942,13 @@ get_installed_data_dir(void)
const char *
get_sys_conf_dir(int idx)
{
- return (idx == 0 ? get_installed_data_dir() : NULL);
+ static char sys_conf_dir[PATH_MAX + 1];
+ if(sys_conf_dir[0] == '\0')
+ {
+ snprintf(sys_conf_dir, sizeof(sys_conf_dir), "%s/etc",
+ get_installed_data_dir());
+ }
+ return (idx == 0 ? sys_conf_dir : NULL);
}
void