All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.expression.mfn.file.Name Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

The newest version!
package com.scudata.expression.mfn.file;

import java.io.File;

import com.scudata.dm.Context;
import com.scudata.dm.LocalFile;
import com.scudata.expression.FileFunction;

/**
 * ȡ?ļ????????Ŀ¼??·????????????Ŀ¼?·???ȫ·??
 * f.name()
 * @author RunQian
 *
 */
public class Name extends FileFunction {
	public Object calculate(Context ctx) {
		try {
			File f = file.getLocalFile().getFile();
			if (f == null) {
				return file.getFileName();
			}
			
			String pathName = f.getAbsolutePath();
			if (option == null || option.indexOf('p') == -1) {
				return LocalFile.removeMainPath(pathName, ctx);
			} else {
				return pathName;
			}
		} catch (Exception e) {
			return file.getFileName();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy