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 LocalFileStore extends With {
	public void prepTarget(StackEntry stack) {
        String name = stack.stringFromSource("Name");
        
        if (StringUtil.isEmpty(name))
        	name = "FileStore_" + stack.getActivity().tempVarName();
        
        String vname = name;
        
        String folder = stack.stringFromSource("RootFolder");
        String path = stack.stringFromSource("RootPath");
        
        if (StringUtil.isEmpty(folder)) {
			stack.log().errorTr(534);
			this.nextOpResume(stack);
			return;
        }
        
        Path lpath = null;
        
        try {
        	lpath = StringUtil.isNotEmpty(path) ? Paths.get(folderpath.substring(1)) : Paths.get(folder);
        }
        catch (Exception x) {
			stack.log().errorTr(535, x);
			this.nextOpResume(stack);
			return;
        }
        FileSystemDriver drv = new FileSystemDriver(lpath);
        
        stack.addVariable(vnamedrv);
        
        this.setTarget(stackdrv);
		this.nextOpResume(stack);
	}
New to GrepCode? Check out our FAQ X