Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improved documentation of the latest configuration database locator algorithm. No code changes. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9cb8194da651637e8afd2d630cc3f636 |
| User & Date: | drh 2020-04-19 15:20:19.667 |
Context
|
2020-04-19
| ||
| 15:24 | Minor typo fix in the documentation. check-in: c0f7c8318b user: drh tags: trunk | |
| 15:20 | Improved documentation of the latest configuration database locator algorithm. No code changes. check-in: 9cb8194da6 user: drh tags: trunk | |
| 15:04 | Further refinement to the configuration database locator algorithm to only use the XDG name if the ~/.config directory exists. check-in: 8388a4680f user: drh tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 |
/* Step 3: if XDG_CONFIG_HOME exists -> $XDG_CONFIG_HOME/fossil.db
*/
zXdgHome = fossil_getenv("XDG_CONFIG_HOME");
if( zXdgHome!=0 ){
return mprintf("%s/fossil.db", zXdgHome);
}
| | | | | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 |
/* Step 3: if XDG_CONFIG_HOME exists -> $XDG_CONFIG_HOME/fossil.db
*/
zXdgHome = fossil_getenv("XDG_CONFIG_HOME");
if( zXdgHome!=0 ){
return mprintf("%s/fossil.db", zXdgHome);
}
/* The HOME variable is required in order to continue.
*/
if( zHome==0 ){
if( isOptional ) return 0;
fossil_panic("cannot locate home directory - please set one of the "
"FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment "
"variables");
}
/* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db
*/
zXdgHome = mprintf("%s/.config", zHome);
if( file_isdir(zXdgHome, ExtFILE)==1 ){
fossil_free(zXdgHome);
return mprintf("%s/.config/fossil.db", zHome);
}
/* Step 5: Otherwise -> $HOME/.fossil
*/
return mprintf("%s/.fossil", zHome);
#endif /* unix */
}
/*
** Open the configuration database. Create the database anew if
|
| ︙ | ︙ |
Changes to www/tech_overview.wiki.
| ︙ | ︙ | |||
129 130 131 132 133 134 135 | <a name='configloc'></a> <h4>2.1.1 Location Of The Configuration Database</h4> On Unix systems, the configuration database is named by the following algorithm: | > | < | > | | < > | | > | | | > | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
<a name='configloc'></a>
<h4>2.1.1 Location Of The Configuration Database</h4>
On Unix systems, the configuration database is named by the following
algorithm:
<blockquote><table border="0">
<tr><td>1. if environment variable FOSSIL_HOME exists
<td> → <td>$FOSSIL_HOME/.fossil
<tr><td>2. if file ~/.fossil exists<td> →<td>~/.fossil
<tr><td>3. if environment variable XDG_CONFIG_HOME exists
<td> →<td>$XDG_CONFIG_HOME/fossil.db
<tr><td>4. if a directory ~/.config exists
<td> →<td>~/.config/fossil.db
<tr><td>5. Otherwise<td> →<td>~/.fossil
</table></blockquote>
Another way of thinking of this algorithm is the following:
* Use "$FOSSIL_HOME/.fossil" if the FOSSIL_HOME variable is defined
* Use the XDG-compatible name (usually ~/.config/fossil.db) on XDG systems
if the ~/.fossil file does not already exist
* Otherwise, use the traditional unix name of "~/.fossil"
This algorithm is complex due to the need for historical compatibility.
Originally, the database was always just "~/.fossil". Then support
for the FOSSIL_HOME environment variable as added. Later, support for the
[https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html|XDG-compatible configation filenames]
was added. Each of these changes needed to continue to support legacy
installations.
On Windows, the configuration database is the first of the following
for which the corresponding environment variables exist:
* %FOSSIL_HOME%/_fossil
* %LOCALAPPDATA%/_fossil
* %APPDATA%/_fossil
|
| ︙ | ︙ |