-
Global paths
All DG3 based applications have a global path and a global setting that can be accessed anywhere in the application. This documents describes how the global paths are setup and configured. This is always the first that is done in an application before anything else can be done. Without the global paths, the application would not be able to know where to read it's startup.conf document that holds global settings for the application.
Calculating the paths
The startup process of the applications involves calculating all the paths that the application need to be able to load it's settings, forms, application templates, scripting engines etc.It is complicated and flexible. It supports the possibility to share space with other applications without interfering with the other applications forms, templates etc. It is also used for calculating and creating it's own work area when generating it's own applications.
The process of setting up the paths can be confusing. Here is how it works.
The method can take the following named parameters: startpath, prefix and sharebuild. It creates a global instance of GobalPaths the first time called, and after that just returning the global paths object. This means that it only obeys the parameters the first time called.
startpath None The name of the directory used for storing startup.conf and the root of all data created by the application. Application data can be definitions of other applications generated by this application and custom modules. prefix None The prefix used by all Defintion paths. Used to make it possible for more than one application to be installed in the same directory without the applications sharing the form, defaults and template defintions. sharebuild False Makes it possible to share templates and defintions for generating new applications without having to share the form definitions. getpaths(startpath='My DEReporter',prefix='DEReporter')
This defintion created a My DEReporter folder in My Documents and has a separate folder for both the forms and the templates.
All the defined paths
startapp the exe file that started this application with absolute path executablepath where the exe files like python.exe is located python pythonw.exe with absolute path pythonshell python.exe with absolute path apppath absolute path to the dg3 libraries defpath Defintion path. It is the root of all forms. The default is apppath + Definitions but a prefix is added with that parameter is set. formpath The root of the application forms. This is normally defpath + forms builddef The folder for the templates and defaults for app generation. Usually the same as defpath unless sharebuild is True, then this will be the same as apppath + Definitions templatepath Where code templates are found. This is the same as buildddef + templates defaultpath Where defaults for code builders are stored. This is the same as builddef + defaults helppath imgpath Follows the same pattern as defpath, that is apppath + Img and then the prefix added if that is defined iconpath imgpath + Icons silkiconpath imgpaths + Icons + silk + icons (relic not in use any more, will be removed) myapps This is the path where you will store your application data. The default is to use My documents folder + this name as the place to store your data. You can set any directory you like by using a absolute path. The user can override your path by adding a redirect file (no extentions) with the absolute path with trailing path separator at the end. Ex. E:\Projects\DG3Projects\ in a redirect file will make the application use this instead. The startup.conf file is always stored in the myapps folder. myapp Default None but can be used to set myapp to inside the application.