|
| 1 | +## Path Logic in Skyscraper |
| 2 | + |
| 3 | +This page describes how Skyscraper processes the different paths and especially |
| 4 | +how the absolute path is calculated when a you provide a relative path. |
| 5 | + |
| 6 | +Do not get confused by the lenghty flow diagram below. It covers gamelist folder, |
| 7 | +input folder and media folder handling. You wiil notice that input folder and |
| 8 | +media folder are processed in the same manner. |
| 9 | + |
| 10 | +<figure markdown style="width:100%"> |
| 11 | + <img style="width:100%" src="../resources/path_handling_flow.svg"/> |
| 12 | + <figcaption>Path processing flowchart</figcaption> |
| 13 | +</figure> |
| 14 | + |
| 15 | +Ah, good you made it to the end of the flow. |
| 16 | + |
| 17 | +Pay attention to the connectors _A-A_, _B-B_ and _C-C_ in the diagram. |
| 18 | + |
| 19 | +_Normalization_ means any surplus `./` and `../` are removed from the path. |
| 20 | +However, at this stage it is not verified if the filepath does exists. Also, any |
| 21 | +symbolic links are not resolved. |
| 22 | + |
| 23 | +Remember the precedence of [CLI and configuration |
| 24 | +options](CONFIGINI.md#configini-options) when you read through this document. |
| 25 | + |
| 26 | +!!! tip "In a Nutshell" |
| 27 | + |
| 28 | + Key takeaway is that a relative input folder and relative media folder are |
| 29 | + always calculated to an absolute folder in relation to the absolute gamelist |
| 30 | + folder. When you apply [`relativePaths="true"`](CONFIGINI.md#relativepaths), |
| 31 | + they will be generated with the relative path in respect to the gamelist- |
| 32 | + or metadata-output (in Pegasus terms) path. |
| 33 | + |
| 34 | +Now, let's see how Skyscraper handles relative path configuration options. |
| 35 | + |
| 36 | +### Computing the Absolute Path from ... |
| 37 | + |
| 38 | +a relative path provided. The next subsections are summarizing the absolute path |
| 39 | +calculation of the different path and file options. |
| 40 | + |
| 41 | +#### Current Working Directory |
| 42 | + |
| 43 | +The current working directory (CWD) is the directory from where you run |
| 44 | +Skyscraper. The absolute path is computed as `<CWD>/<option-value>` for these |
| 45 | +CLI options and their values: |
| 46 | + |
| 47 | +`-a <artwork.xml>` |
| 48 | +`-c <configfile>` |
| 49 | +`-g <gamelistfolder>` |
| 50 | +`-d <cachefolder>` |
| 51 | + |
| 52 | +This means the first part of the flow diagram (Gamelist folder) also applies to |
| 53 | +`-a` and `-d` options and their configfile counterparts. |
| 54 | + |
| 55 | +In contrast, when you provide these three (`<artwork.xml>`,`<gamelistfolder>` |
| 56 | +and `<cachefolder>`) in a configuration INI-file the absolute path it determined |
| 57 | +from the absolute path of the config file. See |
| 58 | +[below](#an-option-in-a-configuration-ini-file). |
| 59 | + |
| 60 | +#### Skyscraper Built-in Config Directory |
| 61 | + |
| 62 | +This is usually `/home/<USER>/.skyscraper/` (base). With [XDG](XDG.md) it is |
| 63 | +slightly different. The files provided with these options |
| 64 | + |
| 65 | +`--excludeFrom <excludes.txt>` |
| 66 | +`--includeFrom <includes.txt>` |
| 67 | + |
| 68 | +are searched in that directory by concatenating the base and for example the |
| 69 | +exclude file. If not found, Skyscraper tries to access them with the current |
| 70 | +working directory as base. |
| 71 | + |
| 72 | +#### the Gamelist Folder |
| 73 | + |
| 74 | +If you define a Gamelist folder either via `-g` or via `gameListFolder=` |
| 75 | +(INI-file) this is the base for the relative paths of |
| 76 | + |
| 77 | +`-i <folder>` or `inputFolder=<folder>` |
| 78 | +`-o <folder>` or `mediaFolder=<folder>` |
| 79 | + |
| 80 | +This is also depicted in the diagram above. |
| 81 | + |
| 82 | +#### Input Folder (ROM-/gamefile-path) |
| 83 | + |
| 84 | +The files provided with these options |
| 85 | + |
| 86 | +`--startAt <game-file-A>` |
| 87 | +`--endAr <game-file-B>` |
| 88 | + |
| 89 | +are first searched in the current working directory. If not found, |
| 90 | +Skyscraper tries to access them in the input folder. |
| 91 | + |
| 92 | +#### an Option in a Configuration INI File |
| 93 | + |
| 94 | +When you have set one of the following parameters in the default configuration |
| 95 | +file (`/home/<USER>/.skyscraper/config.ini`) or in a custom config file defined |
| 96 | +with `-c <configfile>` the path is calculated from the absolute path of |
| 97 | +the location of the config INI-file. |
| 98 | + |
| 99 | +`artworkXml=<artwork.xml>` |
| 100 | +`gameListFolder=<gamelistfolder>` |
| 101 | +`cacheFolder<cachefolder>` |
| 102 | +`importFolder<importfolder>` |
| 103 | + |
| 104 | +!!! note |
| 105 | + |
| 106 | + The `importFolder=` parameter has no counterpart on the command line. |
| 107 | + |
| 108 | +Remember, that this path calculation is different than the logic when using [CLI |
| 109 | +options](#current-working-directory). |
0 commit comments