Fossil SCM

Inserted %USERPROFILE% between %FOSSIL_HOME% and %LOCALAPPDATA% in the code that chooses where the user's account-wide _fossil file lives on Windows. (This is the Windows analog to the ~/.fossil file on POSIX systems.) Also updated the docs to match.

wyoung 2019-08-10 03:23 trunk
Commit 15176c8ae51a1e88caa03e5d78fad892b4b485af650dda96adb784f9bab45cf1
2 files changed +8 -5 +14 -5
+8 -5
--- src/db.c
+++ src/db.c
@@ -1379,17 +1379,20 @@
13791379
db_close_config();
13801380
}
13811381
zHome = fossil_getenv("FOSSIL_HOME");
13821382
#if defined(_WIN32) || defined(__CYGWIN__)
13831383
if( zHome==0 ){
1384
- zHome = fossil_getenv("LOCALAPPDATA");
1384
+ zHome = fossil_getenv("USERPROFILE");
13851385
if( zHome==0 ){
1386
- zHome = fossil_getenv("APPDATA");
1386
+ zHome = fossil_getenv("LOCALAPPDATA");
13871387
if( zHome==0 ){
1388
- char *zDrive = fossil_getenv("HOMEDRIVE");
1389
- char *zPath = fossil_getenv("HOMEPATH");
1390
- if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath);
1388
+ zHome = fossil_getenv("APPDATA");
1389
+ if( zHome==0 ){
1390
+ char *zDrive = fossil_getenv("HOMEDRIVE");
1391
+ char *zPath = fossil_getenv("HOMEPATH");
1392
+ if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath);
1393
+ }
13911394
}
13921395
}
13931396
}
13941397
if( zHome==0 ){
13951398
if( isOptional ) return 0;
13961399
--- src/db.c
+++ src/db.c
@@ -1379,17 +1379,20 @@
1379 db_close_config();
1380 }
1381 zHome = fossil_getenv("FOSSIL_HOME");
1382 #if defined(_WIN32) || defined(__CYGWIN__)
1383 if( zHome==0 ){
1384 zHome = fossil_getenv("LOCALAPPDATA");
1385 if( zHome==0 ){
1386 zHome = fossil_getenv("APPDATA");
1387 if( zHome==0 ){
1388 char *zDrive = fossil_getenv("HOMEDRIVE");
1389 char *zPath = fossil_getenv("HOMEPATH");
1390 if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath);
 
 
 
1391 }
1392 }
1393 }
1394 if( zHome==0 ){
1395 if( isOptional ) return 0;
1396
--- src/db.c
+++ src/db.c
@@ -1379,17 +1379,20 @@
1379 db_close_config();
1380 }
1381 zHome = fossil_getenv("FOSSIL_HOME");
1382 #if defined(_WIN32) || defined(__CYGWIN__)
1383 if( zHome==0 ){
1384 zHome = fossil_getenv("USERPROFILE");
1385 if( zHome==0 ){
1386 zHome = fossil_getenv("LOCALAPPDATA");
1387 if( zHome==0 ){
1388 zHome = fossil_getenv("APPDATA");
1389 if( zHome==0 ){
1390 char *zDrive = fossil_getenv("HOMEDRIVE");
1391 char *zPath = fossil_getenv("HOMEPATH");
1392 if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath);
1393 }
1394 }
1395 }
1396 }
1397 if( zHome==0 ){
1398 if( isOptional ) return 0;
1399
+14 -5
--- www/env-opts.md
+++ www/env-opts.md
@@ -112,16 +112,25 @@
112112
113113
114114
Environment Variables
115115
---------------------
116116
117
+On most platforms, the location of the user’s account-wide `.fossil`
118
+file is either `FOSSIL_HOME` or `HOME`, in that order. This ordering
119
+lets you put this file somewhere other than at the top of your user’s
120
+home directory by defining `FOSSIL_HOME` to mask the always-defined
121
+`HOME`.
117122
118
-`APPDATA`: (Windows) Location of the `~/.fossil` file. The first
119
-environment variable found in the environment from the list
120
-`FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows),
121
-`HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is
122
-used as the location of the `~/.fossil` file.
123
+For native Windows builds and for Cygwin builds, the file is called
124
+`_fossil` instead to avoid problems with old programs that assume file
125
+names cannot begin with a dot, as was true in old versions of Windows
126
+and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
127
+problem with such files, but still we take the safe path in case you’re
128
+on a system with software that can’t cope.) We start our search with
129
+`FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead
130
+try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we
131
+concatenate `HOMEDRIVE` + `HOMEPATH`.
123132
124133
`EDITOR`: Name the editor to use for check-in and stash comments.
125134
Overridden by the local or global `editor` setting or the `VISUAL`
126135
environment variable.
127136
128137
--- www/env-opts.md
+++ www/env-opts.md
@@ -112,16 +112,25 @@
112
113
114 Environment Variables
115 ---------------------
116
 
 
 
 
 
117
118 `APPDATA`: (Windows) Location of the `~/.fossil` file. The first
119 environment variable found in the environment from the list
120 `FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows),
121 `HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is
122 used as the location of the `~/.fossil` file.
 
 
 
 
123
124 `EDITOR`: Name the editor to use for check-in and stash comments.
125 Overridden by the local or global `editor` setting or the `VISUAL`
126 environment variable.
127
128
--- www/env-opts.md
+++ www/env-opts.md
@@ -112,16 +112,25 @@
112
113
114 Environment Variables
115 ---------------------
116
117 On most platforms, the location of the user’s account-wide `.fossil`
118 file is either `FOSSIL_HOME` or `HOME`, in that order. This ordering
119 lets you put this file somewhere other than at the top of your user’s
120 home directory by defining `FOSSIL_HOME` to mask the always-defined
121 `HOME`.
122
123 For native Windows builds and for Cygwin builds, the file is called
124 `_fossil` instead to avoid problems with old programs that assume file
125 names cannot begin with a dot, as was true in old versions of Windows
126 and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a
127 problem with such files, but still we take the safe path in case you’re
128 on a system with software that can’t cope.) We start our search with
129 `FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead
130 try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we
131 concatenate `HOMEDRIVE` + `HOMEPATH`.
132
133 `EDITOR`: Name the editor to use for check-in and stash comments.
134 Overridden by the local or global `editor` setting or the `VISUAL`
135 environment variable.
136
137

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button