InstallMk2
- A replacement for the INSTALL statement
As of BBC BASIC for Windows 4.00 this library is depreciated.
InstallMk2 ( Source |
Text ) Example ( Source | Text | .EXE )
InstallMk2 provides a complete replacement for the INSTALL
statement in BBC BASIC for Windows and solves many of
the inherant problems of using INSTALL.
The INSTALL statement expects a correct path to the library
file that you wish to use, if the library file is not present
INSTALL aborts with a 'File or path not found error'. If
your program requires libraries that are part of the standard
BBC BASIC for Windows installation you need to specify an
exact path to the library. If BBC BASIC for Windows is not
installed or has been installed in a different location then
again INSTALL aborts with an error.
InstallMk2 solves the above problems by providing a portable
way of loading libraries and gives you an error-free API
for loading libraries.
REM Attempt to install WINLIB
IF FN_Install("WINLIB.BBC") = FALSE THEN
PRINT "This program requires WinLib."
ENDIF
FN_Install looks for the library in a number of locations
and loads the library if it is present. The search path includes:
the current directory, in the BBC BASIC for Windows Lib
directory, in a Lib directory in the current directory and
in a Lib directory above the current directory.
You can specify
an absolute pathname to the library if you so wish but
you should do so only if you need to. FN_Install will find
the standard BBC BASIC for Windows libraries regardless of
where BB4W has been installed, if BB4W has not been installed
you can use the return value of FN_Install to provide a helpful
message to the user.
FN_BB4WIsInstalled provides a convenient way to determine
if BBC BASIC for Windows has been installed and you can find
the installation path using FN_ReadBB4WInstallPath.
REM Test if BBC BASIC for Windows is installed
IF FN_BB4WIsInstalled THEN
PRINT "BBC BASIC for Windows is installed on this machine."
PRINT '"It was installed to "FN_ReadBB4WInstallPath"."
ELSE
PRINT "BBC BASIC for Windows is not installed on this machine."
ENDIF
InstallMk2 is not intended to be used as a library, you
must include the code somewhere in your main program for
InstallMk2 to work properly.
Functions and procedures provided
PROC_Install(lib$)
Load a library if it
is present on the local machine, no error if operation fails.
Use this at your own risk, FN_Install(file$) should always
be used instead.
FN_Install(lib$)
Load a library if it is present on the local machine.
Returns:
TRUE - Library exists and has been INSTALLed.
FALSE - Library cannot be found.
FN_FileExists(file$)
Test for the existence of a file.
Returns:
TRUE - if the the file pointed to by file$ exists.
FALSE - if the file does not exist.
FN_BB4WIsInstalled
Determine if BBC BASIC for Windows is installed.
Returns:
TRUE - BBC BASIC for Windows is installed.
FALSE - BBC BASIC for Windows is not installed.
FN_ReadBB4WInstallPath
Read the BBC BASIC for Windows installation path.
Returns:
The path to the BBC BASIC for Windows installation directory
or,
a NULL string if BBC BASIC for Windows is not installed.
|