1. question on func get_file_info
- Posted by Salix <salix at f?eemai?.hu> Jul 25, 2007
- 672 views
Is there a better/simplier/faster solution for this?
include file.e function get_file_info(sequence x) object dx dx=dir(x) if length(dx)=1 then return dx[1] end if return 0 end function
Does anybody use similar routine(s) regularly? Is it worth to propose it for a standard include file? Thanks, Salix
2. Re: question on func get_file_info
- Posted by c.k.lester <euphoric at cklest?r.c?m> Jul 25, 2007
- 655 views
Salix wrote: > > Is there a better/simplier/faster solution for this? > > }}} <eucode> > include file.e > > function get_file_info(sequence x) > object dx > dx=dir(x) > if length(dx)=1 then --<-- possible error; need test You'll get an error here if directory x doesn't exist because x will be a atom and you can't get the length of an atom. > return dx[1] > end if > return 0 > end function > </eucode> {{{
3. Re: question on func get_file_info
- Posted by Salix <salix at fr?emai?.hu> Jul 25, 2007
- 676 views
c.k.lester wrote: > > if length(dx)=1 then --<-- possible error; need test You are right. Is there any other way to collect this information? I mean without calling file.e and dir()? Regards, Salix
4. Re: question on func get_file_info
- Posted by don cole <doncole at p?cbell?net> Jul 25, 2007
- 663 views
- Last edited Jul 26, 2007
Salix wrote: > > Is there a better/simplier/faster solution for this? > > }}} <eucode> > include file.e > > function get_file_info(sequence x) > object dx > dx=dir(x) > if length(dx)=1 then > return dx[1] > end if > return 0 > end function > </eucode> {{{ > > Does anybody use similar routine(s) regularly? > Is it worth to propose it for a standard include file? > > Thanks, > > Salix Hello Salix, I use similar routines with dates. What I would do is create a new include file called my_file.e. Put in get_dir_name(object dir),get_dir_size(object dir)and get_dir_attributes(object dir) etc... Put in an error trap that says "Directry not found". No I don't think this should go into a standard routine. Don Cole