Library Repository
When CODESYS 4 is installed, a variety of extensions are also installed with it. Each extension can contain a library repository. These library repositories are automatically active and available. They do not need to be entered into the LibraryRepositories.prefs.json file.
Creating your own library repositories
In CODESYS 4, you can create any number of your own library repositories.
Custom repositories are configured in the LibraryRepositories.prefs.json file. On Linux, this file is located at ~/.config/CODESYS-4/LibraryRepositories.prefs.json. On Windows, this file is located at %APPDATA%\CODESYS-4\LibraryRepositories.prefs.json. The format of the repository configuration is defined by the deployment server.
LibraryRepositories.prefs.json{
"storages": [
{
"name": "LocalStorage",
"kind": "FileSystem",
"rootDirectory": "D:\\GoLibRepo"
}
],
"c4LibraryRepositories": [
{ "name": "LocalRepository",
"isPublic": true,
"kind": "Local",
"storage": "LocalStorage"
}
]
}For more information, see the following: Libraries.json and Resolve Libraries, Resolve All Libraries
Libraries – Storage format on hard drive
Library repositories are managed via the infrastructure of the deployment server, whereby the local storage module is used for local repositories. The format on the hard drive is therefore canonically defined by the deployment server, but it is simple and is reproduced here for the sake of completeness.
The folder hierarchy within the repository is structured according as follows: Company/Title/Version/FileName.Suffix
| The
|
| The
|
| The
|
| Identical to |
| One of the 4 allowed suffixes:
|
This format allows for easy location of a specific library as well as browsing of all available versions of a library without index files.
Easy configuration
In the localRepositories section, you specify a local repository as a "Name": "Path" pair. When starting for the first time, a repository named Default will be created.
localRepositories section{
"localRepositories": {
"AllLibs": "D:\\C4LibRepo",
"Default": "C:\\Users\\h.mustermann\\AppData\\Local\\CODESYS-4\\managed-libraries"
}
}
...Overlay and suppression
The user-specific level inherits the definitions of the system-wide layer and the extensions. You use this options service to overlay these definitions.
Inherit: Unless otherwise specified, the inherited definitions remain unchanged.
Extend: A section name preceded by
+extends the inherited list instead of replacing it, for example"+storages".Suppress: The value
nullwithout quotation marks suppresses an inherited definition. This is how you disable an inherited repository or theDefaultrepository.
{
"localRepositories": {
"AllLibs": "/home/mustermann/allLibs",
"_Extension_ExampleExtension_1.2.3.4": null
}
}
...In the example, the AllLibs repository is defined and the libraries provided by the ExampleExtension extension in version 1.2.3.4 are suppressed.
For more information, see the following: Restore and Library Cache and Resolving Library Dependencies