[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross-platform !PATH (was Cross-platform PWD)



Robert S. Mallozzi wrote:
> 

> How about this one:
> 
> How does one expand !PATH in a platform independent
> manner?
> 
> CD, CURRENT = currentDir
> !PATH = EXPAND_PATH ('+' + currentDir) + delimiter + !PATH
> 
> "delimiter" is platform-dependent, but required :-(

You can use the system variable !VERSION:

	case ( strupcase(!version.os_family)) of
		'UNIX': delim = '/'
		'MACOS': delim = 
		'VMS': delim =
		'WINDOWS': delim = '\'
		else: print, 'OS uncrecognized'
	endcase

!VERSION.OS contains more specific OS information.

Dave
-- 

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    David S. Foster         Univ. of California, San Diego
     Programmer/Analyst     Brain Image Analysis Laboratory
     foster@bial1.ucsd.edu  Department of Psychiatry
     (619) 622-5892         8950 Via La Jolla Drive, Suite 2240
                            La Jolla, CA  92037
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~