Question Set Temporary Directory

#1
Hi All,

I want to set SESSION:TEMP-DIRECTORY without hard-cording the value in pf file.Please share your ideas.

Expect to implement : -T %TEMP% (use the Environment variable) instead of -T c:\temp.

Can I define -T in ini file ?
If Yes, how can i access it in pf file ?

Note : It works, If i define like this in the target C:\Progress\OpenEdge\bin\prowin32.exe -T %TEMP% -pf menu_testconnection.pf.But I want to hide -T value from the user.

Thank you in advance.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
#2
I want to set SESSION:TEMP-DIRECTORY without hard-cording the value in pf file
Is the intent that each user has their own uniquely-named temp directory? What is the goal that you are trying to achieve? Please start with the problem, not the proposed solution.

Can I define -T in ini file ?
No. You can set environment variables there, like TEMP, but not client startup parameters.

If Yes, how can i access it in pf file ?
You don't "access" a .pf. A .pf is a collection of client startup parameters that you invoke collectively with the -pf startup parameter on your client's command line. You can specify "-T c:\temp" in a .pf but not "-T %TEMP%". The "%TEMP%" will be taken as a literal path; it won't be expanded by the shell.

If you want unique -T directories, which is my guess, then either set the environment for the user and then use -T %TEMP% on the command line, or else generate a .pf dynamically (containing "-T c:\uniquepath") and then use that with -pf pfname.pf on the command line.

But I want to hide -T value from the user.
You probably can't. The temp directory is part of the state of the process and any somewhat-resourceful user can see their prowin32.exe process' environment and file handles, unless the OS is really locked down.

What's the point of hiding it?
 
#3
Is the intent that each user has their own uniquely-named temp directory? What is the goal that you are trying to achieve? Please start with the problem, not the proposed solution.
Yes.I want to maintain a separate temp-directory (which already in windows for that particular user) uniquely for each user.


You don't "access" a .pf. A .pf is a collection of client startup parameters that you invoke collectively with the -pf startup parameter on your client's command line. You can specify "-T c:\temp" in a .pf but not "-T %TEMP%". The "%TEMP%" will be taken as a literal path; it won't be expanded by the shell..
It works, If i define like this in the target/command line as, C:\Progress\OpenEdge\bin\prowin32.exe -T %TEMP% -pf menu_testconnection.pf

What's the point of hiding it?
Hide means, If user right clicks, it is visible -T value.I want to include into a file.
 
#4
If a user right-clicks on what?

As Rob said -- you can't really hide it from the user. You can, perhaps, make it a bit more difficult to find but you cannot hide it from a clever enough user.

A .pf file cannot dereference variables. So if you want the -T value inside a .pf file to vary you will need to create a new .pf file each time you want to vary the -T value.

If this is a UNIX command line application you could do something like this:

Code:
mkdir /tmp/protemp$(($PPID % 10)) 2> /dev/null    # make sure the temp directory exists
echo  "-T  /tmp/protemp$(($PPID % 10))" > dasht.pf
mpro dbname -p startup.p -pf dasht.pf
You could do similar things with a BAT file on Windows.
 
Top