DirectuX
20-11-2019, 17:57
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
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
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
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