Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ************************************************************************
 #
 #  DivConq
 #
 #  http://divconq.com/
 #
 #  Copyright:
 #    Copyright 2014 eTimeline, LLC. All rights reserved.
 #
#  License:
#    See the license.txt file in the project's top-level directory for details.
#  Authors:
#    * Andy White
************************************************************************ */
package divconq.script.inst.file;
public class LocalFolder extends With {
	public void prepTarget(StackEntry stack) {
        String name = stack.stringFromSource("Name");
        
        if (StringUtil.isEmpty(name))
        	name = "LocalFolder_" + stack.getActivity().tempVarName();
        
        String vname = name;
        
        String path = stack.stringFromSource("Path");
        
        if (StringUtil.isEmpty(path)) {
			stack.log().errorTr(525);
			this.nextOpResume(stack);
			return;
        }
        
        Path lpath = null;
        
        try {
        	lpath = Paths.get(path);
        }
        catch (Exception x) {
			stack.log().errorTr(526, x);
			this.nextOpResume(stack);
			return;
        }
        FileSystemDriver drv = new FileSystemDriver(lpath);
        FileSystemFile fh = new FileSystemFile(drv.true);
        
        stack.addVariable("LocalFS_" + stack.getActivity().tempVarName(), drv);
        stack.addVariable(vnamefh);
        
        this.setTarget(stackfh);
		this.nextOpResume(stack);
	}
New to GrepCode? Check out our FAQ X