If SetKey fails, it doesn't return an error.

In the example below, setkey always return defaultDBFilename string, even if iniFilename is readonly and the key is not stored.
Expected : setkey return an error code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
APP_SetEntryPoint(Main)
 
Uses "Console"
uses "INI"
Uses "File"
 
#Region "Constants"
 
Const iniFilename as string = "LM.ini"
Const defaultDBFilename as string = "LM_DB.sql"
 
#EndRegion
 
Function Main() As Long
  if (not resetINI) Then
      printl "error"
      WaitKey
      Stop
  Else
  endif
end Function
 
Function resetINI() as Boolean
'[breakpoint] <Any note here. Breakpoint will be set to line following this statement>
 
  Dim myINI as new CINIFILE(APP_ScriptPath & iniFilename)
  dim s as String
  s=myINI.setKey("DB", "pathToDB", defaultDBFilename)
  MsgBox s
  if len(s) = 0 then Return %FALSE
 
  Return TRUE
   
end function