Blame view

src/idl_misc/JPBLib_for_Dustemwrap/General/str2path.pro 443 Bytes
6db3528a   Jean-Philippe Bernard   adding librairies...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FUNCTION str2path,str

IF STRPOS(str, '\') GE 0 THEN sep = '\' ELSE sep = '/' ; simple WINDOWS test (GV 2013-09-09)

;vv=strsplit(str,'/',/extract)
;path=''
;FOR i=0L,n_elements(vv)-2 DO path=path+'/'+vv(i)
;path=path+'/'

vv=strsplit(str,sep,/extract)
path=''
FOR i=0L,n_elements(vv)-2 DO path=path+sep+vv(i)
path=path+sep

IF STRPOS(path, '\') GE 0 THEN path = STRMID(path,1) ; remove first '\' for WINDOWS (GV 2013-09-09)

RETURN,path

END