adsini_path environment variable

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
wriedmann
Posts: 3689
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

adsini_path environment variable

Post by wriedmann »

Hello,
on a customers site I have two different networks: one open to the internet, the other not. Both have the same ADS server, but with a different IP address.
To make ADS work in this environment, I need to differentiate the ads.ini.
In VO, the following code works:

Code: Select all

local cIPAddress as string
local cAdsIniLoc as string
	
cIPAddress := AllTrim( GetIPAddress( "alpilx" ) )
if ! cIPAddress == ""
  cAdsIniLoc := oSysIni:GetStringCheck( "Settings", "AdsIniLoc_" + cIPAddress, "g:\alpifakt\192.168.1.0" )
  SetEnvironmentVariable( String2PSZ( "adsini_path" ), String2PSZ( cAdsIniLoc ) )
endif
The X# code is this:

Code: Select all

local oHostEntry as System.Net.IPHostEntry
local oIpAddress as System.Net.IPAddress
local cAdsIniLoc as string

oHostEntry := System.Net.DNS.GetHostEntry( ProgSettings.DatabaseConnectionInfo:ServerName )
if oHostEntry:AddressList:Length > 0
  oIpAddress := oHostEntry:AddressList[1]
  cAdsIniLoc := ProgSettings.SysIni:GetStringCheck( "Settings", "AdsIniLoc_" + oIpAddress:ToString(), "g:\alpifakt\192.168.1.0" )
  Environment.SetEnvironmentVariable( "adsini_path", cAdsIniLoc, EnvironmentVariableTarget.Process )
endif
Unfortunately this code does works, it seems that the X# RDD does not respects that setting.

The ADS help file has the following text about this functionality:

Code: Select all

Windows

In order for the ads.ini file to be used, it must be located in the application directory, the Windows directory, the Windows System directory, or the client's search path.

In addition, if an environment variable exists with the name adsini_path, that path will be used to locate the ads.ini file. This can be helpful when you do not want to modify the application’s search path, but still need the ads.ini file to exist in a directory multiple users have rights to (for example on Windows Vista installations). An application can often set the environment variable at run-time before calling any Advantage functions, which avoids the need to set a per-workstation environment variable.
Thank you very much for any help!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4352
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: adsini_path environment variable

Post by robert »

Wolfgang,
I am not sure what we can do about this.
The whole ads.ini handling and ads_initpath is handled inside the ADS DLLs.
I checked the ADS RDD for Vulcan and cannot find anything related

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3689
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: adsini_path environment variable

Post by wriedmann »

Hi Robert,
thank you very much for checking!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply