- Aug
- 2,799
- 144
I use my .btm files (via a stream) as .ini files,
so that I keep the .ini data associated with my .btm code.
Example:
I cannot do that with library files.
I've developed a code method to do this,
attaching the .ini file as a stream of the library file.
For example,
attached to my utils.library file,
I have a stream file called utils.ini
In the following example;
csx is a function contained in the utils.library file;
Note that I have to hard-code the _libraryname in each function in my library files.
I would like to suggest adding a _libraryname internal variable,
which, when accessed from any function in a library file,
would provide the complete path and file name of the library file,
just as _batchname returns the full path and file name of the current batch file.
It is an empty string if no library file is active.
Joe
so that I keep the .ini data associated with my .btm code.
Example:
Code:
set HashValue=%@iniread[%_batchname:%@name[%_batchname].ini,Main,hashvalue]
I cannot do that with library files.
I've developed a code method to do this,
attaching the .ini file as a stream of the library file.
For example,
attached to my utils.library file,
I have a stream file called utils.ini
In the following example;
csx is a function contained in the utils.library file;
Code:
csx {
@setlocal
@echo off
if isdir r:\temp set temp=r:\temp
rem _library is defined in TCSTART.BTM
rem C:\...\TCMD36>echo %_library
rem "C:\Program Files\JPSoft\TCMD36\library"
set _libraryname=%_library\utils.library
alias csc="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe"
set theEXE=r:\temp\%@name[%1].exe
iff %# eq 0 then
echo USAGE: csx test.csx
quit
endiff
set HashValue=%@iniread[%_libraryname:%@name[%_libraryname].ini,Main,hashvalue]
Note that I have to hard-code the _libraryname in each function in my library files.
I would like to suggest adding a _libraryname internal variable,
which, when accessed from any function in a library file,
would provide the complete path and file name of the library file,
just as _batchname returns the full path and file name of the current batch file.
It is an empty string if no library file is active.
Joe