Skip to content

[RETHINK] Setup/Init process

This issue describes what happens when starting an HSE application.

Determination Mechanism

HSE applications determine the <%BaseLocation%> (the base path for the "_Config" and "_Data" folders) in this order:

  1. <%APP-NAME%>.ini config file next to the .exe
    • if found, read configdir and datadir keys from file
  2. One level up from application directory
    • look for <%APP-NAME%>_Config\ and <%APP-NAME%>_Data\ folders
    • if found, use those
  3. In <%ProgramData%>\<%COMP-NAME%>\
    • look for <%APP-NAME%>_Config\ and <%APP-NAME%>_Data\ folders
    • if found, use those
  • Use first match (if none is found, see below)
  • Log selected paths in startup.vi

The preferred location for the <%BaseLocation%> is <%ProgramData%>\<%COMP-NAME%>\

Execution Sequence

When running the app, it will check the following in the <%BaseLocation%>:

  • "_Config" folder
    • looks for <%APP-NAME%>_Config\
    • if this folder does not exist, see case "A"
  • Shipping configuration
    • if this does not exist, see case "B"
  • Main configuration file
    • looks for <%APP-NAME%>_Config\config.ini
    • if this file does not exist, see case "C"
    • if it exists, get configured unit -> <%UNIT%>
    • if configured unit is "Default", see case "D"
  • Configured Unit folder
    • looks for <%APP-NAME%>_Config\Unit_<%UNIT%>\
    • if this folder does not exist, see case "E"

Scenarios

  • Case A: No _Config folder at all
    • throw error and exit
  • Case B: No shipping config
    • throw error and exit
  • Case C: No config.ini
    • copy config.ini.default to config.ini
    • goto case D
  • Case D: Default unit configured
    • parse "_config" folder for potentially existing Unit folders
    • ask user to select existing Unit or provide new Unit name
    • if new name: duplicate Unit_Default to provided Unit_NewName
    • update config.ini accordingly with new unit name
  • Case E: Configured unit folder missing
    • goto case D

For each case, the application has to take care of setting access rights on <%BaseLocation%>\ accordingly.

In the future, we will look into cascading configs and UI-based config editors.


Notes

  • Program Data (like in a Windows ProgramData folder) stores configuration files, settings, and shared data for computer programs, often hidden and protected. Program data is essential for a program's operation.
  • Public documents (in a Public Documents folder) are user-created files and documents meant to be shared with other users of the same computer or network. Public documents are content provided by users for general access and sharing.

Todos

  • Create VI to set permissions
Edited by Joerg Hampel