Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / main / Tools / Protect.MUI / getpath.e
blob3a80a67256e3e2d119fdbf04de4fa58eb09ad473
1 OPT MODULE
2 OPT EXPORT
3 OPT PREPROCESS
5 EXPORT PROC getpath(currentdir:PTR TO LONG)
6 DEF moins=0,str,pos,test
8 test:=String(StrLen(currentdir))
9 StrCopy(test,currentdir,ALL)
10 IF test[StrLen(test)-1]<>":"
11 IF test[StrLen(test)-1]="/" THEN SetStr(currentdir,StrLen(currentdir)-1)
12 str:=String(StrLen(currentdir))
13 pos:=String(StrLen(currentdir))
14 moins:=0
15 REPEAT
16 MidStr(str,currentdir,0,StrLen(currentdir)-moins)
17 moins:=moins+1
18 UNTIL StrCmp(RightStr(pos,str,1),'/',StrLen(str))=TRUE OR StrCmp(RightStr(pos,str,1),':',StrLen(str))=TRUE
19 StrCopy(currentdir,str,ALL)
20 ELSE
21 StringF(currentdir,'')
22 ENDIF
23 ENDPROC currentdir