Fossil SCM
Improved documentation of the latest configuration database locator algorithm. No code changes.
Commit
9cb8194da651637e8afd2d630cc3f6362e777c33ae4ab65a32a343bae4388998
Parent
8388a4680f9e2db…
2 files changed
+3
-3
+14
-11
M
src/db.c
+3
-3
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1461,28 +1461,28 @@ | ||
| 1461 | 1461 | zXdgHome = fossil_getenv("XDG_CONFIG_HOME"); |
| 1462 | 1462 | if( zXdgHome!=0 ){ |
| 1463 | 1463 | return mprintf("%s/fossil.db", zXdgHome); |
| 1464 | 1464 | } |
| 1465 | 1465 | |
| 1466 | - /* Step 4: If HOME does not exist -> ERROR | |
| 1466 | + /* The HOME variable is required in order to continue. | |
| 1467 | 1467 | */ |
| 1468 | 1468 | if( zHome==0 ){ |
| 1469 | 1469 | if( isOptional ) return 0; |
| 1470 | 1470 | fossil_panic("cannot locate home directory - please set one of the " |
| 1471 | 1471 | "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment " |
| 1472 | 1472 | "variables"); |
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | - /* Step 5: If $HOME/.config is a directory -> $HOME/.config/fossil.db | |
| 1475 | + /* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db | |
| 1476 | 1476 | */ |
| 1477 | 1477 | zXdgHome = mprintf("%s/.config", zHome); |
| 1478 | 1478 | if( file_isdir(zXdgHome, ExtFILE)==1 ){ |
| 1479 | 1479 | fossil_free(zXdgHome); |
| 1480 | 1480 | return mprintf("%s/.config/fossil.db", zHome); |
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | - /* Step 6: Otherwise -> $HOME/.fossil | |
| 1483 | + /* Step 5: Otherwise -> $HOME/.fossil | |
| 1484 | 1484 | */ |
| 1485 | 1485 | return mprintf("%s/.fossil", zHome); |
| 1486 | 1486 | #endif /* unix */ |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1461,28 +1461,28 @@ | |
| 1461 | zXdgHome = fossil_getenv("XDG_CONFIG_HOME"); |
| 1462 | if( zXdgHome!=0 ){ |
| 1463 | return mprintf("%s/fossil.db", zXdgHome); |
| 1464 | } |
| 1465 | |
| 1466 | /* Step 4: If HOME does not exist -> ERROR |
| 1467 | */ |
| 1468 | if( zHome==0 ){ |
| 1469 | if( isOptional ) return 0; |
| 1470 | fossil_panic("cannot locate home directory - please set one of the " |
| 1471 | "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment " |
| 1472 | "variables"); |
| 1473 | } |
| 1474 | |
| 1475 | /* Step 5: If $HOME/.config is a directory -> $HOME/.config/fossil.db |
| 1476 | */ |
| 1477 | zXdgHome = mprintf("%s/.config", zHome); |
| 1478 | if( file_isdir(zXdgHome, ExtFILE)==1 ){ |
| 1479 | fossil_free(zXdgHome); |
| 1480 | return mprintf("%s/.config/fossil.db", zHome); |
| 1481 | } |
| 1482 | |
| 1483 | /* Step 6: Otherwise -> $HOME/.fossil |
| 1484 | */ |
| 1485 | return mprintf("%s/.fossil", zHome); |
| 1486 | #endif /* unix */ |
| 1487 | } |
| 1488 | |
| 1489 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1461,28 +1461,28 @@ | |
| 1461 | zXdgHome = fossil_getenv("XDG_CONFIG_HOME"); |
| 1462 | if( zXdgHome!=0 ){ |
| 1463 | return mprintf("%s/fossil.db", zXdgHome); |
| 1464 | } |
| 1465 | |
| 1466 | /* The HOME variable is required in order to continue. |
| 1467 | */ |
| 1468 | if( zHome==0 ){ |
| 1469 | if( isOptional ) return 0; |
| 1470 | fossil_panic("cannot locate home directory - please set one of the " |
| 1471 | "FOSSIL_HOME, XDG_CONFIG_HOME, or HOME environment " |
| 1472 | "variables"); |
| 1473 | } |
| 1474 | |
| 1475 | /* Step 4: If $HOME/.config is a directory -> $HOME/.config/fossil.db |
| 1476 | */ |
| 1477 | zXdgHome = mprintf("%s/.config", zHome); |
| 1478 | if( file_isdir(zXdgHome, ExtFILE)==1 ){ |
| 1479 | fossil_free(zXdgHome); |
| 1480 | return mprintf("%s/.config/fossil.db", zHome); |
| 1481 | } |
| 1482 | |
| 1483 | /* Step 5: Otherwise -> $HOME/.fossil |
| 1484 | */ |
| 1485 | return mprintf("%s/.fossil", zHome); |
| 1486 | #endif /* unix */ |
| 1487 | } |
| 1488 | |
| 1489 |
+14
-11
| --- www/tech_overview.wiki | ||
| +++ www/tech_overview.wiki | ||
| @@ -131,31 +131,34 @@ | ||
| 131 | 131 | <h4>2.1.1 Location Of The Configuration Database</h4> |
| 132 | 132 | |
| 133 | 133 | On Unix systems, the configuration database is named by the following |
| 134 | 134 | algorithm: |
| 135 | 135 | |
| 136 | - * if environment variable FOSSIL_HOME exists → $FOSSIL_HOME/.fossil | |
| 137 | - * if environment variable HOME exists and | |
| 138 | - if file $HOME/fossil exists → $HOME/.fossil | |
| 139 | - * if environment variable XDG_CONFIG_HOME exists | |
| 140 | - → $XDG_CONFIG_HOME/fossil.db | |
| 141 | - * if environment variable HOME does not exist → <i>ERROR</i> | |
| 142 | - * if a directory named $HOME/.config exists → $HOME/.config/fossil.db | |
| 143 | - * Otherwise $HOME/.fossil | |
| 136 | +<blockquote><table border="0"> | |
| 137 | +<tr><td>1. if environment variable FOSSIL_HOME exists | |
| 138 | +<td> → <td>$FOSSIL_HOME/.fossil | |
| 139 | +<tr><td>2. if file ~/.fossil exists<td> →<td>~/.fossil | |
| 140 | +<tr><td>3. if environment variable XDG_CONFIG_HOME exists | |
| 141 | + <td> →<td>$XDG_CONFIG_HOME/fossil.db | |
| 142 | +<tr><td>4. if a directory ~/.config exists | |
| 143 | + <td> →<td>~/.config/fossil.db | |
| 144 | +<tr><td>5. Otherwise<td> →<td>~/.fossil | |
| 145 | +</table></blockquote> | |
| 144 | 146 | |
| 145 | 147 | Another way of thinking of this algorithm is the following: |
| 146 | 148 | |
| 147 | 149 | * Use "$FOSSIL_HOME/.fossil" if the FOSSIL_HOME variable is defined |
| 148 | - * Use the XDG-compatible name (~/.config/fossil.db) on XDG systems | |
| 150 | + * Use the XDG-compatible name (usually ~/.config/fossil.db) on XDG systems | |
| 149 | 151 | if the ~/.fossil file does not already exist |
| 150 | 152 | * Otherwise, use the traditional unix name of "~/.fossil" |
| 151 | 153 | |
| 152 | 154 | This algorithm is complex due to the need for historical compatibility. |
| 153 | -Originally, the database was always just "$HOME/.fossil". Then support | |
| 155 | +Originally, the database was always just "~/.fossil". Then support | |
| 154 | 156 | for the FOSSIL_HOME environment variable as added. Later, support for the |
| 155 | 157 | [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html|XDG-compatible configation filenames] |
| 156 | -was added. Each of these changes needed to continue to support legacy installs. | |
| 158 | +was added. Each of these changes needed to continue to support legacy | |
| 159 | +installations. | |
| 157 | 160 | |
| 158 | 161 | On Windows, the configuration database is the first of the following |
| 159 | 162 | for which the corresponding environment variables exist: |
| 160 | 163 | |
| 161 | 164 | * %FOSSIL_HOME%/_fossil |
| 162 | 165 |
| --- www/tech_overview.wiki | |
| +++ www/tech_overview.wiki | |
| @@ -131,31 +131,34 @@ | |
| 131 | <h4>2.1.1 Location Of The Configuration Database</h4> |
| 132 | |
| 133 | On Unix systems, the configuration database is named by the following |
| 134 | algorithm: |
| 135 | |
| 136 | * if environment variable FOSSIL_HOME exists → $FOSSIL_HOME/.fossil |
| 137 | * if environment variable HOME exists and |
| 138 | if file $HOME/fossil exists → $HOME/.fossil |
| 139 | * if environment variable XDG_CONFIG_HOME exists |
| 140 | → $XDG_CONFIG_HOME/fossil.db |
| 141 | * if environment variable HOME does not exist → <i>ERROR</i> |
| 142 | * if a directory named $HOME/.config exists → $HOME/.config/fossil.db |
| 143 | * Otherwise $HOME/.fossil |
| 144 | |
| 145 | Another way of thinking of this algorithm is the following: |
| 146 | |
| 147 | * Use "$FOSSIL_HOME/.fossil" if the FOSSIL_HOME variable is defined |
| 148 | * Use the XDG-compatible name (~/.config/fossil.db) on XDG systems |
| 149 | if the ~/.fossil file does not already exist |
| 150 | * Otherwise, use the traditional unix name of "~/.fossil" |
| 151 | |
| 152 | This algorithm is complex due to the need for historical compatibility. |
| 153 | Originally, the database was always just "$HOME/.fossil". Then support |
| 154 | for the FOSSIL_HOME environment variable as added. Later, support for the |
| 155 | [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html|XDG-compatible configation filenames] |
| 156 | was added. Each of these changes needed to continue to support legacy installs. |
| 157 | |
| 158 | On Windows, the configuration database is the first of the following |
| 159 | for which the corresponding environment variables exist: |
| 160 | |
| 161 | * %FOSSIL_HOME%/_fossil |
| 162 |
| --- www/tech_overview.wiki | |
| +++ www/tech_overview.wiki | |
| @@ -131,31 +131,34 @@ | |
| 131 | <h4>2.1.1 Location Of The Configuration Database</h4> |
| 132 | |
| 133 | On Unix systems, the configuration database is named by the following |
| 134 | algorithm: |
| 135 | |
| 136 | <blockquote><table border="0"> |
| 137 | <tr><td>1. if environment variable FOSSIL_HOME exists |
| 138 | <td> → <td>$FOSSIL_HOME/.fossil |
| 139 | <tr><td>2. if file ~/.fossil exists<td> →<td>~/.fossil |
| 140 | <tr><td>3. if environment variable XDG_CONFIG_HOME exists |
| 141 | <td> →<td>$XDG_CONFIG_HOME/fossil.db |
| 142 | <tr><td>4. if a directory ~/.config exists |
| 143 | <td> →<td>~/.config/fossil.db |
| 144 | <tr><td>5. Otherwise<td> →<td>~/.fossil |
| 145 | </table></blockquote> |
| 146 | |
| 147 | Another way of thinking of this algorithm is the following: |
| 148 | |
| 149 | * Use "$FOSSIL_HOME/.fossil" if the FOSSIL_HOME variable is defined |
| 150 | * Use the XDG-compatible name (usually ~/.config/fossil.db) on XDG systems |
| 151 | if the ~/.fossil file does not already exist |
| 152 | * Otherwise, use the traditional unix name of "~/.fossil" |
| 153 | |
| 154 | This algorithm is complex due to the need for historical compatibility. |
| 155 | Originally, the database was always just "~/.fossil". Then support |
| 156 | for the FOSSIL_HOME environment variable as added. Later, support for the |
| 157 | [https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html|XDG-compatible configation filenames] |
| 158 | was added. Each of these changes needed to continue to support legacy |
| 159 | installations. |
| 160 | |
| 161 | On Windows, the configuration database is the first of the following |
| 162 | for which the corresponding environment variables exist: |
| 163 | |
| 164 | * %FOSSIL_HOME%/_fossil |
| 165 |