001 /** 002 * Implements the Cold Fusion Function getfilefrompath 003 */ 004 package railo.runtime.functions.file; 005 006 007 import railo.runtime.PageContext; 008 import railo.runtime.ext.function.Function; 009 010 public final class GetFileFromPath implements Function { 011 public static String call(PageContext pc , String path) { 012 path = path.replace('\\', '/'); 013 // get file name 014 if(path.endsWith("..")) return "."; 015 if(path.endsWith(".") || path.endsWith("/")) return ""; 016 return pc.getConfig().getResource(path).getName(); 017 } 018 }