Evaluate a file as it were inserted at that line
 a relative file_path is considered to be relative to the including file
 i.e. '../file_in_the_same_dir.irt'
434694
def eval_file(file_path)
      parent_context = IRB.CurrentContext
      new_io = IRB::FileInputMethod.new(File.expand_path(file_path, parent_context.io.file_name))
      new_irb = IRB::Irb.new(parent_context.workspace, new_io)
      new_irb.context.irb_name = File.basename(new_io.file_name)
      new_irb.context.irb_path = new_io.file_name
      IRT::Session.eval_input(new_irb.context, :file)
      IRT::Session.exit
    end
630431
def relative_path(sub_directory='', function_index=1):
    
    frm = inspect.currentframe()
    for i in range(function_index):
        frm = frm.f_back
    if frm.f_code.co_name == 'run_code':
        frm = frm.f_back

    if not isinstance(sub_directory, list):
        sub_directory = sub_directory.replace('\\','/').split('/')

    path = os.path.split(frm.f_code.co_filename)[0]
    if sub_directory:
        path = os.path.abspath(os.path.join(path, *sub_directory))
    return path
1164071
def _check_and_handle_includes(self, from_file):
        
        logger.debug("Check/handle includes from %s", from_file)
        try:
            paths = self._parser.get("INCLUDE", "paths")
        except (config_parser.NoSectionError,
                config_parser.NoOptionError) as exc:
            logger.debug("_check_and_handle_includes: EXCEPTION: %s", exc)
            return
        paths_lines = [p.strip() for p in paths.split("\n")]
        logger.debug("paths = %s (wanted just once; CLEARING)", paths_lines)
        self._parser.remove_option("INCLUDE", "paths")
        for f in paths_lines:
            abspath = (f if os.path.isabs(f) else
                       os.path.abspath(
                           os.path.join(os.path.dirname(from_file), f)))
            use_path = os.path.normpath(abspath)
            if use_path in self._parsed_files:
                raise RecursionInConfigFile("In %s: %s already read",
                                            from_file, use_path)
            self._parsed_files.append(use_path)
            self._handle_rc_file(use_path)
902210
function(relativePath, line) {
    const file = setupHelper.setupFolderAbsolutePath() + '/' + relativePath;
    return setupHelper.handleShellResponse(shell.exec('echo "' + line + '" >> ' + file));
  }
150990
def at_line(context, file, line)
      return if file && TRACE_IGNORE_FILES.include?(File.expand_path(file))

      # If stopped for a breakpoint or catchpoint, can't play any delayed steps
      # as they'll move away from the interruption point. (Unsure if scenario is
      # possible, but just keeping assertions in check.)
      @delayed = Hash.new(0) unless :step == context.stop_reason

      if @delayed[:next] > 1     # If any delayed nexts/steps, do 'em.
        step_over @delayed[:next] - 1
        @delayed = Hash.new(0)

      elsif @delayed[:step] > 1
        step @delayed[:step] - 1
        @delayed = Hash.new(0)

      elsif @delayed[:finish] > 0
        finish
        @delayed = Hash.new(0)

      else  # Otherwise, resume the pry session at the stopped line.
        resume_pry context
      end
    end
752322
public static String getRelativePath(File file, File srcDir) {

		String base = srcDir.getPath();
		String filePath = file.getPath();

		String relativePath = new File(base).toURI()
				.relativize(new File(filePath).toURI()).getPath();
		return relativePath;
	}
444805
def relativesymlink(src_file, dest_file):
    
    # Perform relative symlinking
    try:
        print(os.path.relpath(src_file), os.path.relpath(dest_file))
        os.symlink(
            # Find the relative path for the source file and the destination file
            os.path.relpath(src_file),
            os.path.relpath(dest_file)
        )
    # Except os errors
    except OSError as exception:
        # If the os error is anything but directory exists, then raise
        if exception.errno != errno.EEXIST:
            raise
1272491
def load_file_or_directory(path):
    
    assert os.path.exists(path), "{0} does not exist!".format(path)
    absolute_path = os.path.abspath(path)
    if not os.path.isdir(path):
        yield absolute_path
    else:
        for root, dirs, file_paths in os.walk(path):
            for file_path in file_paths:
                yield os.path.join(root, file_path)
889209
private long addFilesInDir(Path path, List<FileStatus> files, boolean logExcludedFiles)
			throws IOException {
		final FileSystem fs = path.getFileSystem();

		long length = 0;

		for(FileStatus dir: fs.listStatus(path)) {
			if (dir.isDir()) {
				if (acceptFile(dir) && enumerateNestedFiles) {
					length += addFilesInDir(dir.getPath(), files, logExcludedFiles);
				} else {
					if (logExcludedFiles && LOG.isDebugEnabled()) {
						LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
					}
				}
			}
			else {
				if(acceptFile(dir)) {
					files.add(dir);
					length += dir.getLen();
					testForUnsplittable(dir);
				} else {
					if (logExcludedFiles && LOG.isDebugEnabled()) {
						LOG.debug("Directory "+dir.getPath().toString()+" did not pass the file-filter and is excluded.");
					}
				}
			}
		}
		return length;
	}
964369
def p_include(self, p):
        ''''''
        if len(p) == 4:
            p[0] = ast.Include(name=p[2], path=p[3], lineno=p.lineno(1))
        else:
            p[0] = ast.Include(name=None, path=p[2], lineno=p.lineno(1))
1265942
private static String getRelativePath(File src, File target) {
        String[] srcComponents = getCanonicalPath(src).replace(File.separatorChar, '/').split("/");
        String[] targetComponents = getCanonicalPath(target).replace(File.separatorChar, '/').split("/");

        if (srcComponents.length > 0 && targetComponents.length > 0 && !targetComponents[0].equals(srcComponents[0])) {
            return null;
        }

        int common = 0;
        for (int minLength = Math.min(srcComponents.length, targetComponents.length); common < minLength; common++) {
            if (!srcComponents[common].equals(targetComponents[common])) {
                break;
            }
        }

        StringBuilder result = new StringBuilder();

        // Paths in a file are relative to the file's directory, so subtract one
        // to skip the final filename component.
        for (int i = common; i < srcComponents.length - 1; i++) {
            if (result.length() != 0) {
                result.append('/');
            }
            result.append("..");
        }

        for (int i = common; i < targetComponents.length; i++) {
            if (result.length() != 0) {
                result.append('/');
            }
            result.append(targetComponents[i]);
        }

        return result.toString();
    }
646041
def file?(path)
      if stat = self.stat(path)
        stat.file?
      elsif path =~ /^#{Volt.root}\/app\/components\/[^\/]+[.]rb$/
        # Matches a component
        return true
      else
        false
      end
    end
180925
def ensure_dir_path(self, path, relative=False):
        
        if not relative:
            rel_path = self.relpath(path)
        else:
            rel_path = path

        # Locator
        if self.is_locator(rel_path, relative=True):
            path = path.rstrip('/')

        # Directory
        elif rel_path:
            path = path.rstrip('/') + '/'
        # else: root
        return path
784763
function getIncludePath(path, options) {
  var includePath;
  var filePath;
  var views = options.views;

  // Abs path
  if (path.charAt(0) == '/') {
    includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
  }
  // Relative paths
  else {
    // Look relative to a passed filename first
    if (options.filename) {
      filePath = exports.resolveInclude(path, options.filename);
      if (fs.existsSync(filePath)) {
        includePath = filePath;
      }
    }
    // Then look in any views directories
    if (!includePath) {
      if (Array.isArray(views) && views.some(function (v) {
        filePath = exports.resolveInclude(path, v, true);
        return fs.existsSync(filePath);
      })) {
        includePath = filePath;
      }
    }
    if (!includePath) {
      throw new Error('Could not find the include file "' +
          options.escapeFunction(path) + '"');
    }
  }
  return includePath;
}
983064
def read_relative_file(filename):
    """"""
    with open(join(dirname(abspath(__file__)), filename)) as f:
        return f.read()
205596
def relative_path(reference_path, input_path):
        
        start_path = os.path.dirname(reference_path)
        try:
            relative_path = os.path.relpath(input_path, start_path)
        except ValueError:
            # LOGGER.info(e.message)
            relative_path = input_path
        return relative_path
281264
def get_relative_file_path(absolute_file_path):
    '''
    
    '''
    global country_package_dir_path
    assert country_package_dir_path is not None
    relative_file_path = absolute_file_path[len(country_package_dir_path):]
    if relative_file_path.startswith('/'):
        relative_file_path = relative_file_path[1:]
    return relative_file_path