comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to set environment variables in IDLDE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to set environment variables in IDLDE [message #94903 is a reply to message #74407] Wed, 29 November 2017 10:28 Go to previous message
Luke is currently offline  Luke
Messages: 4
Registered: October 2006
Junior Member
I know this is a really old thread, but since this is where I landed in my great search on this issue.. in 2017.. I figured I'd post my solution since I cannot seem to make anything else work. This is code you can put in your startup.pro file, and it assumes you declare your environmental vars with the export command in your .bash_profile. Change the relevant lines as needed. Works like a charm for me.. after all these years of declaring pathnames explicitly for all my scripts run in my IDLDE environment.

;Set user environmental variables
file = getenv('HOME')+path_sep()+'.bash_profile'
line = ''
openr, lun, file, /get_lun
while not eof(lun) do begin & $
readf, lun, line & $
if strcmp(line, 'export ', 7, /fold_case) then begin & $
temp = strsplit(strmid(line, 7), '=', /extract) & $
env = strsplit(temp[1], path_sep(), /extract, count=n) & $
for ienv=0, n-1 do $
if strcmp(env[ienv], '$', 1) then $
env[ienv] = getenv(strmid(env[ienv],1)) & $
if product(strlen(env) gt 0) then $
setenv, temp[0]+'='+strjoin(env, path_sep()) & $
endif & $
endwhile
free_lun, lun
[Message index]
 
Read Message
Read Message
Previous Topic: Context Menu ib widget_tree
Next Topic: CURSOR without mouse

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:57:16 PDT 2025

Total time taken to generate the page: 0.00395 seconds