From Digital Man@VERT to All on Wed Nov 8 07:47:49 2000
While on the subject of loadable module/shell compatibility, I thought I would bring to your attention a couple of other points about insuring compatibility with Synchronet v3:
In a multi-threaded process (as Synchronet v3 is), there is no such idea of "current working directory" for each thread. So, relative file paths (paths starting with '.') should not be used in loadable modules or command shells and the Baja function: CHANGE_DIR should never be used.
* Side note * Start-up directories are supported for external programs because they are run in their own process and therefor can maintain their own "current working directory".
In general, absolute paths (e.g. "c:\mymod" or "/mymod") should NOT be hard-coded in loadable modules or shells either. Instead, you should use one of the sysop-configurable directory variables (ctrl_dir, data_dir, text_dir, node_dir or exec_dir) as a base path. These directory variables can be used in command strings with the following command-line specifiers (from Appendix A in the sysop manual):
%! exec directory
%z text directory
%k ctrl directory
%j data directory
%n node directory
* Note * the trailing slash is included in the variable text.
So if your module's config files where stored in ctrl/mymod, you could access those files with a path string "%kmymod/filename".
Or if you wanted to access data files in the main Synchronet directory, you could with a path string "%j../myfile".
Most 3rd party modules and shells already do this kind of thing with the path specifiers, but I thought I would just remind programmers of what was required to be compatible with Synchronet v3. :-)