Image Location/path on script

38 views
Skip to first unread message

rowellmagno

unread,
Jun 19, 2022, 10:38:31 PM6/19/22
to OpenROAD Users Mailing List
HI,

Is there a way to get the current OpenROAD Image location (where the IMAGE was run from) in code?

or show in code the path declared on II_CONFIG or II_SYSTEM?

I'm trying to create a code that will define the current location to use for included file.


regards,
Rowell

Adrian Williamson

unread,
Jun 20, 2022, 3:35:35 AM6/20/22
to openroa...@googlegroups.com

Hi,

 

You have access to the environment variables through the SessionObject.GetEnv() so you can get to the environment  through that. (CurSession.GetEnv())

 

OpenROAD has two other system variables which you use at your discretion II_W4GLAPPS_SYS and II_W4GLAPPS_DIR

 

II_W4GLAPPS_SYS is the system location where OpenROAD keeps all its own image files of various flavours and it typically is:

 

%II_SYSTEM%/ingres/w4glapps

 

II_W4GLAPPS_DIR is user defined – II_W4GLAPPS_SYS is typically in a restricted location under the Programfiles area appropriate for you 32/64 bit architecture. (on windows anyway).

 

If you define II_W4GLAPPS_DIR and place you images in there, OpenROAD will find them when asked to run them. I’ve not checked this for while so you may want to test it but it searches current location, II_W4GLAPPS_SYS, II_W4GLAPPS_DIR and the path for image files. (Not sure what order)

 

To actually find the location of where your running process was started from is not something I know off the top of my head.

 

Utilities such as ProcessExplorer can get this information from running processes – so it may be that there exists something in the API for your OS that might give a clue.

 

Cheers

 

Adrian

--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openroad-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/48989dd9-cb67-4ce2-bfee-898a1551fbecn%40googlegroups.com.

Adrian Williamson

unread,
Jun 20, 2022, 3:43:17 AM6/20/22
to openroa...@googlegroups.com

Hi

 

For getting full path to running process, Google is your friend here;

 

Dos command prompt:

 

wmic process get ProcessID,ExecutablePath

 

Linux

 

I was reminded by a need to extract the build date from an image file for a splash screen – I can open my own image file in blob and find it now that I know where it is.

 

Cheers

 

Adrian

Adrian Williamson

unread,
Jun 20, 2022, 3:48:50 AM6/20/22
to openroa...@googlegroups.com

Doh, that just gets me the w4glrun.exe location, will need to try again for the location of the image….

 

Wmic – my new best friend:

 

C:\WINDOWS\system32>wmic process where "name='w4gldev.exe'" get commandline /format:list

 

CommandLine="C:\Program Files\Ingres\ingresXH\ingres\bin\w4gldev.exe" "runimage" "workbnch.img" -cclassic -Tmin -Lworkbench.log ""

 

From: Adrian Williamson <adrian.w...@rationalcommerce.com>
Sent: 20 June 2022 08:43
To: 'openroa...@googlegroups.com' <openroa...@googlegroups.com>
Subject: RE: [openroad-users] Image Location/path on script

 

Hi

 

For getting full path to running process, Google is your friend here;

 

Dos command prompt:

 

wmic process get ProcessID,ExecutablePath

 

Linux

 

I was reminded by a need to extract the build date from an image file for a splash screen – I can open my own image file in blob and find it now that I know where it is.

 

Cheers

 

Adrian

 

From: openroa...@googlegroups.com <openroa...@googlegroups.com> On Behalf Of Adrian Williamson


Sent: 20 June 2022 08:36
To: openroa...@googlegroups.com

Bodo Bergmann

unread,
Jun 20, 2022, 4:24:10 AM6/20/22
to openroa...@googlegroups.com

Hi Rowell,

 

When setting the environment variable II_W4GL_TRACE_IMAGE_VERSION=TRUE the location of loaded image files (the image you run and all included image files) will be printed to the log file (and the OpenROAD Trace Window).

 

Included applications will always have to be placed in the directory specified by the II_W4GLAPPS_DIR environment variable (default: %II_SYSTEM%\ingres\w4glapps).
Therefore I am not sure what kind of code you want to create – using a batch script that sets the II_W4GLAPPS_DIR environment variable should be sufficient to
define the location to use for included image files.

 

Kind regards,

Bodo.

 

Bodo Bergmann
Engineering Architect
Actian | OpenROAD Engineering
www.actian.com
GESELLSCHAFTSANGABEN: Actian Germany GmbH | Sitz der Gesellschaft: Halenreie 42, 22359 Hamburg | Geschäftsführung: Stephen Padgett, Marc Monahan | Handelsregister: Amtsgericht Hamburg | HRB 135991 | USt-IdNr: DE252449897

 

From: 'rowellmagno' via OpenROAD Users Mailing List <openroa...@googlegroups.com>
Sent: Monday, June 20, 2022 4:39 AM
To: OpenROAD Users Mailing List <openroa...@googlegroups.com>
Subject: [openroad-users] Image Location/path on script

 

HI,

--

Paul White

unread,
Jun 20, 2022, 4:29:43 AM6/20/22
to openroa...@googlegroups.com, Adrian Williamson

Hi Adrian,

maybe these will help, but I think Rowell is looking for an answer using OpenROAD code:

https://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows

https://docs.microsoft.com/en-us/sysinternals/downloads/handle

c:\Program Files\SysinternalsSuite>handle.exe |findstr /i ".img"

This should identify all included images if the files are currently open - not sure when that happens.


I remember using a bit of code which dumps out the OpenRoad procexec call stack.  Sometimes there would be confusion when two applications have a component of the same name and we needed to confirm.  I don't recall seeing the image file name though.

Paul

To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/002701d8847a%242d11afc0%2487350f40%24%40rationalcommerce.com.
-- 
Paul White<br>
Shift Seven Solutions<br>
<b>m: 0414681799</b><br>
p: 0754482137<br>
e: paul....@shift7solutions.com.au<br>
w: https://www.shift7solutions.com.au<br>
International: +61414681799<br>

rowellmagno

unread,
Jun 20, 2022, 5:41:11 AM6/20/22
to OpenROAD Users Mailing List
Hi Everyone,
      Thank you for responding to this, Adrian's initial reply got me what I'm looking but apparently not what will fix my concern.

We're actually testing LoanNRun, our images being sent to the client needs to have some external files to function properly.
This is why I am looking for the path/location of the image it is running from. Checking with my colleague, the image location is somewhere on the AppData Folder under USERS, no ENVIRONMENT VARIABLE points there.

Is there a way to trace this?

regards,
Rowell

Paul White

unread,
Jun 20, 2022, 5:44:55 AM6/20/22
to openroa...@googlegroups.com

do you have either of these?

c:\>set | find /i "APPDATA"
APPDATA=C:\Users\paul\AppData\Roaming
LOCALAPPDATA=C:\Users\paul\AppData\Local


E:\Ingres .NET Data Provider\v2.1>set | find /i "appdata"
APPDATA=C:\Users\pwhite\AppData\Roaming
LOCALAPPDATA=C:\Users\pwhite\Local Settings\Application Data

To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/a0ba9701-c8d4-47df-9983-e61eefe279cbn%40googlegroups.com.
--
Paul White
Shift Seven Solutions
m: 0414681799
p: 0754482137
e: paul....@shift7solutions.com.au
w: https://www.shift7solutions.com.au
International: +61414681799

Bodo Bergmann

unread,
Jun 20, 2022, 6:28:27 AM6/20/22
to openroa...@googlegroups.com

Hi Rowell,

 

The location of the image file does not mean that the OpenROAD process is using this directory as the current location.

You can get the current working directory from within OpenROAD application using CurSession.WorkingDirectory
(see https://docs.actian.com/openroad/11.2/index.html#page/LangRef/WorkingDirectory_Attribute_(SessionObject).htm).

 

For Loadnrun you should have a look at the client commands mentioned in:

https://docs.actian.com/openroad/11.2/index.html#page/ServerRef/Client_Commands.htm##ww413494

The APPDATA environment variable is used there, you should have this environment variable in your environment.

 

Bodo

Adrian Williamson

unread,
Jun 20, 2022, 6:33:16 AM6/20/22
to openroa...@googlegroups.com

Hi,

 

I would give that trace variable a go that Bodo mentioned, sounds like it will tell you where the images are ending up with load’n’run.

 

II_W4GL_TRACE_IMAGE_VERSION=TRUE the location of loaded image files (the image you run and all included image files) will be printed to the log file

 

What additional files are you talking about?

 

DLLs or config data in text files etc?

 

Cheers

 

Adrian

rowellmagno

unread,
Jun 20, 2022, 8:03:22 PM6/20/22
to OpenROAD Users Mailing List
Hi,

Thank you, I'll give Bodo's answer a try.

and yes, additional files are config files.

regards,
Rowell

Reply all
Reply to author
Forward
0 new messages