Is it possible to check in a cfg file if d: / MS_connect exists and if not check if c: / MS-connect exists and put the following variable MS_DATA_HOORN to that path?
Yes. Here's a link to the Online Help about this.
MaryB
Power GeoPak 08.11.09.918Power InRoads 08.11.09.918OpenRoads Designer 2021 R2
Hi Nico,
Nico Caspel said:Is it possible to check in a cfg file if d: / MS_connect exists
In addition to Mary's answer: I am not sure what do you mean by d: / MS_connect, because it's not valid Windows path, and also it's not clear whether it's folder or file.
But I agree with Mary that the linked help page is the place where you should start.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi,
ms_connect is a directory with organization data and therefore exists on the D: or on the C: drive.
I want to test in a cfg file if there is a D: / ms_connect directory. If so, then ms_data_hoorn = D: / ms_connect must be set and if it is not there, it must be checked whether c: / ms_connect exists. if yes then ms_data_hoorn = C: / ms_connect must be set.
if exists d: / ms_connectset ms_data_horn = D: / ms_connectelse ms_data_horn = C: / ms_connector something
This is absolutely possible. Did you read the link I sent about operatives?
as Mary wrote: Did you bother to study documentation Mary linked? Plus, did you try to use Search? The same question was discussed many times already (both for folders and files), so answer is available already (e.g. this one).
Nico Caspel said:I want to test in a cfg file if there is a D: / ms_connect directory
Why did you choose to do not follow standards and to use syntax not used anywhere? It's like a decision "I want to create something confusing and annoying." We are on Windows, so a file path consists from backslashes, plus no spaces exists around a drive specification. So why you simply do not write D:\ms_connect\? Or, when you prefer to use style used in MicroStation configuration files (which is also perfectly fine), to write D:/ms_connect/?
Also, it's recommended to use ending backslash, when folder is specified, because from C:\ms_connect it's not clear whether it's folder or file (with no extension), whereas when C:\ms_connect\ is used, it's clear.
Nico Caspel said:then ms_data_hoorn = D: / ms_connect must be set and if it is not there, it must be checked whether c: / ms_connect exists. if yes then ms_data_hoorn = C: / ms_connect must be set.
Your (pseudo)code does something different. I do not see any test whether C:\ms_connect\ exists or not.
I guess this should work:
%if exists(D:/ms_connect/) ms_data_horn = D:/ms_connect/ %elif exists (C:/ms_connect/) ms_data_horn = C:/ms_connect/ %endif
Regards,
Answer Verified By: Marc Thomas