" > BLib.File 1.02 J.G.Harston + Platform-independant filing functions : (: 25 PROCf_init - initialise filing-system variables <5 ----------------------------------------------- F f_init P0):B%:A%=B%-1 A%:=A$,A%) +":$%&^@\-",A$,1)):=A$,A$+d$,d$)-1) ="" : : ) FNfn_leaf(path$) - returns leafname ) ----------------------------------- &ݤfn_leaf(A$):A%,B%:A%=A$,":",2) +B%=A%:A%=A$,d$,A%+1):A%=0:=A$,B%+1) : : ) FNfn_path(path$) - returns pathname ) ----------------------------------- "&ݤfn_path(A$):A%,B%:A%=A$,":",2) ,)B%=A%:A%=A$,d$,A%+1):A%=0:=A$,B%) 6: @: J4 FNfn_ext(path$) - returns leafname's extension T4 ---------------------------------------------- ^ݤfn_ext(A$):A$,s$)=0:="" h1 A%:A%=A$+1:A%=A%-1:":"+d$+s$,A$,A%,1)) r A$,A%,1)=s$:=A$,A%) ="" |: : 8 FNfn_noext(path$) - returns path with no extension 8 -------------------------------------------------- !ݤfn_noext(A$):A$,s$)=0:=A$ 1 A%:A%=A$+1:A%=A%-1:":"+s$+d$,A$,A%,1)) "A$,A%,1)=s$:=A$,A%-1) =A$ : : = FNfn_fullpath(path$, file$) - return full absolute path = ------------------------------------------------------- ݤfn_fullpath(P$,A$) '"$%&^\-",A$,1)):(os%-24)=0:=A$ A$,":")A$,1)=d$:=A$ =P$+d$,P$,1)<>d$)+A$ : : &9 PROCf_gbpb() - multiple get-bytes or put-bytes call 09 --------------------------------------------------- :%f_gbpb(A%,chn%,addr%,num%,ptr%) D=?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:<&FFFF:&FFD1: NA%=1A%=3:#?X%=X%!9 X5:A%=1A%=2:#?X%,?X%!1 A%=3A%=4:?X%!1=#?X% b5X%!1=X%!1+1:X%!5=X%!5-1:(#?X% A%>2) X%!5<1: l: v: - FNfs - get current filing system number - --------------------------------------- )ݤfs:<&FFFF:A%,Y%,E%:=(&FFDA)&FF =29 : : ( PROCf_dir(dir$) - select directory + PROCf_delete(object$) - delete object + ------------------------------------- >f_dir(A$):(os%-24):A$="cd "+A$ A$="dir "+f_name(A$) Ff_delete(A$):(os%-24)=8:A$="rm "+A$ A$="delete "+f_name(A$)  A$: : :  D PROCf_cdir(dir$) - create a directory only if it doesn't exist D --------------------------------------------------------------  :f_cdir(A$):(os%-24):A$="mkdir "+A$ A$="cdir "+A$ * 4 A$: > H : : R A$: \: f: pE FNf_name(path$) - ensure no extension if no extension specified zE --------------------------------------------------------------- #ݤf_name(A$)=A$+".",?(P-3)=0) : : B FNf_openin(file$) - open an input file ensuring no extension B ------------------------------------------------------------ !ݤf_openin(A$)=(f_name(A$)) : : C FNf_openup(file$) - open an update file ensuring no extension C ------------------------------------------------------------- !ݤf_openup(A$)=(f_name(A$)) : : D FNf_openout(file$) - open an output file ensuring no extension D -------------------------------------------------------------- "ݤf_openout(A$)=(f_name(A$)) $: .: 8@ FNf_info(object$) - returns file type, file info in X%!... B@ ---------------------------------------------------------- LOݤf_info(A$):<&FFFF:$name%=A$:?X%=name%:X%?1=name%256:A%=5:=(&FFDD)&FF Vos%<>32:=0 `dir%,sh%:dir%319 j*ș"FindFirstFile",f_name(A$),dir%sh% tLsh%=-1:ș"GetFileAttributes",f_name(A$)sh%:=((sh%16)16+1)(sh%<>-1) ~5ș"FindClose",sh%:X%!10=dir%!32:dir%!28:X%!10=-1 ,X%?14=(?dir%1)*8+(&33 ((?dir%16)=0)) *ș"FileTimeToSystemTime",dir%+20,X%+16 BA%=(X%!16&FFFF)-1981:X%?15=X%?22+(A%&70)*2:X%?16=X%?18+A%*16 8X%?17=X%?24:X%?18=X%?26:X%?19=X%?28:=(?dir%16)16+1 : : 3 PROCf_settype(object%, type%) - set file type 3 ---------------------------------------------  f_settype(A$,A%):os%=32: H<&FFFF:f_info(A$):X%?3=A%:X%?4=(A%256)&F0:X%?5=&FF:A%=1:&FFDD  : :