
/*
 *  Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
*/
package oracle.sample;

import org.unix4j.context.DefaultExecutionContext;

import org.unix4j.context.ExecutionContext;

import java.io.File;

/**
 * <p>
 * </p>
 *
 * @author velsubra
 */
public class Unix4JExecutionContextFactory implements org.unix4j.context.ExecutionContextFactory {

    public Unix4JExecutionContextFactory(String dir) {
        this.dir = new DefaultExecutionContext(new File(dir));

    }
    private DefaultExecutionContext dir = null;


    @Override
    public ExecutionContext createExecutionContext() {
        return dir;
    }

    public String getCurrentWorkingDir() {
        return dir.getCurrentDirectory().getAbsolutePath();
    }
}
