ooRexx 3.1.1 and Windows XP, service pack 2.
Sysini is for the Windows operating system only. The first parameter is:
inifile
The name of the INI file with which you would like to work. The default is WIN.INI.
However, a file name only does not seem to work. For example, if I pass a file name, such as, "test.ini", which is in the current directory, then the sysini routine cannot find the file. But if I pass ".\test.ini" then the sysini routine can find the file.
The behavior of sysini seems to be consistent with operating systems, such as, Linux which do not consider the current directory to be in the path of a file specification. However, sysini is for the Windows operating system. A file specification (file name only) for a file in the current directory should be found without a directory specification as part of the file path.
Anonymous
Logged In: YES
user_id=931756
Originator: NO
I am not sure anything can be done about this. The reason is that the INFILE argument is passed "as-is" (except for the WIN.INI substitution) to the Windows APIs GetPrivateProfileString and WritePrivateProfileString. So the behavior you are seeing actually comes from the behavior of the underlying Windows API, not the SysIni function.
I am just not sure that it is prudent to change the behavior of this function because it would mean that it has a different behavior than what is expected by someone with knowledge of the underlying Windows APIs.
Logged In: YES
user_id=1256161
Originator: YES
David,
Perhaps the documentation for infile needs to be altered or bolstered. As it reads now, a simple file name, such as, "win.ini," may be an argument. From what you wrote, the documentation should indicate that a file path specification should be used as an argument. This is not a big issue but we might as well have clear documentation instead of sparse and somewhat misleading documentation. I am not complaining. Rather suggesting an improvement.
Terry
Logged In: YES
user_id=1223125
Originator: NO
I know this is an "old" bug report, but I'd like to offer my observations. The bug reported can not be duplicated with 3.1.2 or 3.2 Rev 853 running under WinXP SP2. In fact I use SysIni in ooRexxTry and do NOT provide a path to the file.
Here's the catch: When a path is not specified the file is created in the Windows folder, in my case C:\Windows. Since the user id that I use has administrative rights on XP, I have no problem. So I suspect that SysIni is working as designed; however, Terry probably encountered 1 of 2 situations: 1) The user does not have write privileges to the Windows folder or 2) He just didn't think to look anywhere other than the current working folder for the file.
Here's sample code and output:
Arguments
Code
ini_stream = .stream~new('c:\windows\atest.ini')
if ini_stream~query('exists') == '' then
say 'File Does NOT Exists'
else
say 'File DOES Exists'
SysIni('atest.ini','oorexx','key1',date('s'))
if ini_stream~query('exists') == '' then
say 'File Does NOT Exists'
else
say 'File DOES Exists'
say 'The Value Of key1 In atest.ini =' SysIni('atest.ini','oorexx','key1')
Says
File Does NOT Exists
File DOES Exists
The Value Of key1 In atest.ini = 20071002
Results
Errors/Information
Code Execution Complete
Logged In: YES
user_id=191588
Originator: NO
Microsoft's documentation for the underlying Windows APIs (GetPrivateProfileString and WritePrivateProfileString) that are used for SysIni() specifiy that if the INI file name is not a complete path name, the file will be searched for in the Windows directory.
As David pointed out, SysIni() is working as designed (as designed by Microsoft.) I have updated the documentation to make this clear.
Committed revision 1730.
This bug was 'cleared up' with a documentation clarification. That clarification would have made it to the 4.0.0 release. Switching from pending to closed.