Finding your directory in yab
#1
The old way:

Code:
//////////////////////////////////////////////////////////////////
sub getdir$( programname$)
// find out in which directory we are in
////////////////////////////////////////////////////////////////
local path$
local catch
catch=0
if (!peek("isbound")) then
   path$=system$("ps")
   x=instr(path$,"/"+programname$)
   path$=left$(path$,x)
   for x=len(path$)-1 to 1 step -1
      if (instr(path$," ",x) and catch=0) catch=x+1
   next
   path$=right$(path$,len(path$)-catch)
   path$=trim$(path$)
   if path$="/" then
        path$ = trim$(system$("pwd"))+"/"
   else
      path$="/"+path$
   endif

else
path$=trim$(peek$("directory") )
path$=path$+"/"

end if

return path$
end sub


The new way:


Code:
//////////////////////////////////////////////////////////////////
sub path$()
// find out in which directory we are in
////////////////////////////////////////////////////////////////
path$=attribute get$ "",""
path$=path$+"/"
return path$
end sub


This uses attribute get$ with no attribute name and no file name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting