Update script load order (#943)

Signed-off-by: Scott Rushworth <openhab@5iver.com>
pull/946/head
Scott Rushworth 2019-04-21 03:28:27 -04:00 committed by Jerome Luckenbach
parent c99f97eb6f
commit 52090ae565
1 changed files with 11 additions and 10 deletions

View File

@ -37,22 +37,23 @@ Scripts should be placed in the `${OPENHAB_CONF}/automation/jsr223/` directory.
This directory will vary, [based on the type of openHAB installation used](https://www.openhab.org/docs/installation/linux.html#installation).
For example, Linux installations created with a package installer will use `/etc/openhab2/automation/jsr223/`, and manual installations will use `/opt/openhab2/conf/automation/jsr223/`.
When openHAB starts, scripts will be loaded in an order based on their file name and path.
When openHAB starts, scripts will be loaded in an order based on their file name.
If the scripts have the same name, which should rarely happen, the parent directories will be considered in the sort.
For example, with the following scripts and directory structure...
```text
├── automation/jsr223
│   ├── 00
│   │   ├── 00_00.py
│   │   └── 01_00.py
│   ├── 00.py
│   ├── 01
│   │   ├── 00_01.py
│   │   └── 01_01.py
│   └── 01.py
│   ├── dir1
│   │   ├── 001_script.py
│   │   └── script.py
│   ├── 001_script.py
│   ├── dir2
│   │   ├── 002_script.py
│   │   └── script.py
│   └── script.py
```
... the load order will be: `00.py`, `00/00_00.py`, `00/01_00.py`, `01.py`, `01/00_01.py`, `01/01_01.py`.
... the load order will be: `/001_script.py`, `/dir1/001_script.py`, `/dir2/002_script.py`, `/script.py`, `/dir1/script.py`, `/dir2/script.py`.
<a name="presets"></a>