001 package railo.runtime.functions.file; 002 003 import java.io.File; 004 005 import railo.commons.io.res.Resource; 006 import railo.runtime.PageContext; 007 import railo.runtime.exp.FunctionException; 008 import railo.runtime.exp.PageException; 009 import railo.runtime.op.Caster; 010 011 public class GetFreeSpace { 012 013 public static double call(PageContext pc , Object obj) throws PageException { 014 Resource res=Caster.toResource(pc,obj, true, pc.getConfig().allowRealPath()); 015 if(!(res instanceof File)) throw new FunctionException(pc,"getFreeSpace",1,"filepath","this function is only supported for the local filesystem"); 016 File file=(File) res; 017 return file.getFreeSpace(); 018 } 019 }