Remove need for path variable

This commit is contained in:
Pax1601
2023-12-06 12:37:59 +01:00
parent dcff462b32
commit fa0643987b
10 changed files with 89 additions and 112 deletions

View File

@@ -5,7 +5,6 @@ local debug = false -- True enables debug printing using DCS messages
-- .dll related variables
Olympus.OlympusDLL = nil
Olympus.DLLsloaded = false
Olympus.OlympusModPath = os.getenv('DCSOLYMPUS_PATH')..'\\bin\\'
-- Logger reference
Olympus.log = mist.Logger:new("Olympus", 'info')
@@ -31,6 +30,10 @@ Olympus.weapons = {} -- Table holding references to all the currently existing
Olympus.missionStartTime = DCS.getRealTime()
Olympus.napalmCounter = 1
Olympus.fireCounter = 1
-- Load the current instance folder
local lfs = require('lfs')
------------------------------------------------------------------------------------------------------
-- Olympus functions
------------------------------------------------------------------------------------------------------
@@ -49,7 +52,7 @@ end
-- Loads the olympus .dll
function Olympus.loadDLLs()
-- Add the .dll paths
package.cpath = package.cpath..';'..Olympus.OlympusModPath..'?.dll;'
package.cpath = package.cpath..';'..Olympus.instancePath..'?.dll;'
local status
status, Olympus.OlympusDLL = pcall(require, 'olympus')
@@ -1361,6 +1364,10 @@ end
------------------------------------------------------------------------------------------------------
-- Olympus startup script
------------------------------------------------------------------------------------------------------
Olympus.instancePath = lfs.writedir().."Mods\\Services\\Olympus\\bin\\"
Olympus.notify("Starting DCS Olympus backend session in "..Olympus.instancePath, 2)
local OlympusName = 'Olympus ' .. version .. ' C++ module';
Olympus.DLLsloaded = Olympus.loadDLLs()
if Olympus.DLLsloaded then
@@ -1402,11 +1409,3 @@ Olympus.initializeUnits()
Olympus.notify("OlympusCommand script " .. version .. " loaded successfully", 2, true)
-- Load the current instance folder
local lfs = require('lfs')
Olympus.instancePath = lfs.writedir().."Mods\\Services\\Olympus"
Olympus.notify("Starting DCS Olympus backend session in "..Olympus.instancePath, 2)
Olympus.OlympusDLL.setInstancePath()

View File

@@ -1,10 +1,10 @@
local version = 'v0.4.11-alpha-rc3'
local lfs = require("lfs")
Olympus = {}
Olympus.OlympusDLL = nil
Olympus.cppRESTDLL = nil
Olympus.DLLsloaded = false
Olympus.OlympusModPath = os.getenv('DCSOLYMPUS_PATH')..'\\bin\\'
Olympus.OlympusModPath = lfs.writedir().."Mods\\Services\\Olympus\\bin\\"
log.write('Olympus.HOOKS.LUA', log.INFO,'Executing OlympusHook.lua')
@@ -14,7 +14,7 @@ function Olympus.loadDLLs()
local status
log.write('Olympus.HOOKS.LUA', log.INFO, 'Loading olympus.dll from ['..Olympus.OlympusModPath..']')
status, Olympus.OlympusDLL = pcall(require, 'olympus')
status, Olympus.OlympusDLL = require("olympus")
if status then
log.write('Olympus.HOOKS.LUA', log.INFO, 'olympus.dll loaded successfully')
return true