12-08-2021, 01:50 AM
The libraries look to be safe. They do not appear to delete files for any reason in the library folder of CanelaDB. They do prune files as needed in CanelaDB/database/ folder and CanelaDB/config/ folders.
On the other hand, LCM does aggressively clean out files inside of its CanelaDB/libraries/ folder. I will paste the code below.
On the other hand, LCM does aggressively clean out files inside of its CanelaDB/libraries/ folder. I will paste the code below.
Code:
command initializeCanelaDB
local tLibraryPath
wait 0 milliseconds with messages ## GIVE THE ENGINE A CHANCE TO SPIN UP
put "LCM-AUTH-CODE-HERE" into gCDBAuthKey
set the itemDel to "/"
if the environment is "development" then
put item 1 to -2 of (the effective fileName of this stack) into tLibraryPath
else
switch the platform
case "android"
case "iPhone"
put specialFolderPath("engine") into tLibraryPath
break
case "MacOS"
put specialFolderPath("support") into tLibraryPath
put "/" & "CanelaSoftware/" & gCSManifestA["productName"] & "/" & gCSManifestA["productVersion"] & "/data" after tLibraryPath --LCM SPECIFIC PATH
break
case "Win32"
case "Linux"
put item 1 to -2 of (the effective fileName of this stack) into tLibraryPath
break
end switch
end if
put "/config/CanelaDB/libraries/" after tLibraryPath
if the environment <> "development" then
repeat for each line xLine in files(tLibraryPath)
if xLine <> "CDB_Header.lib" and xLine <> "CDB_Starter.lib" then
delete file (tLibraryPath & xLine)
end if
end repeat
else
if there is a file (tLibraryPath & ".DS_Store") then
delete file (tLibraryPath & ".DS_Store")
end if
end if
--START CanelaDB
csi_verifyLibraries tLibraryPath
try
start using stack (tLibraryPath & "CDB_Header.lib")
start using stack (tLibraryPath & "CDB_Starter.lib")
catch tError
answer "There was an error initializing CanelaDB:" && tError
exit to top
end try
--SET OPTIONAL LOGGING MODE
cdb_SetLogMode "message box"
cdb_loadTable "cdbCache"
end initializeCanelaDB