Extract a relative path for the app

 @api private
171475
def relative_path_from(root_path, path)
      project_path = Pathname.new(path)
      return project_path if project_path.relative?
      project_path.relative_path_from(root_path)
    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
1338657
def setup_backtrace_cleaner_path
      return unless Rails.backtrace_cleaner.instance_variable_get(:@root) == '/'
      Rails.backtrace_cleaner.instance_variable_set :@root, Rails.root.to_s
    end
1042507
def path_to_url(path, relative_to = nil)
      # Find the parent path we're in
      path = Pathname.new(path).realpath
      base = load_paths.find { |lp| path.to_s =~ /\A#{Regexp.escape(lp.realpath.to_s)}/ }

      path = path.relative_path_from(base).cleanpath

      if relative_to
        relative_path_to_url(path, relative_to, base).to_s
      else
        "/#{path}"
      end
    end
64511
def get_app_dir(app):
    
    path = __app_dirs__.get(app)
    if path is not None:
        return path
    else:
        p = app.split('.')
        try:
            path = pkg.resource_filename(p[0], '')
        except ImportError as e:
            log.error("Can't import app %s" % app)
            log.exception(e)
            path = ''
        if len(p) > 1:
            path = os.path.join(path, *p[1:])
        
        __app_dirs__[app] = path
        return path
216496
def full_path(self):
        """"""
        if Path(self.path).is_absolute():
            return self.path
        else:
            return str(self.app_root / self.path)
1190217
def path(self, key):
    ''''''
    return os.path.join(self.root_path, self.relative_path(key))
238660
def path(cls, ref):
        
        return osp.join(ref.repo.git_dir, "logs", to_native_path(ref.path))
904788
def path
      temporary = []
      actual_route = nil
      router do |route|
        actual_route = extract_and_format_route(route)
        temporary.push(actual_route) unless temporary.include?(actual_route)
        actual_route
      end
      temporary
    end
324637
def path_to_url(path, relative_to = nil)

      # Find the parent path we're in
      path = Pathname.new(path).realpath
      base = self.load_paths.find{|lp| path.to_s =~ /\A#{Regexp.escape(lp.realpath.to_s)}/ }

      path = path.relative_path_from(base).cleanpath
      
      if relative_to
        if relative_to.to_s =~ /\A\//
          relative_to = Pathname.new(File.dirname(relative_to.to_s)).relative_path_from(base).cleanpath
        else
          relative_to = Pathname.new(File.dirname(relative_to.to_s))
        end
        path = Pathname.new("/" + path.to_s).relative_path_from(Pathname.new("/" + relative_to.to_s))
        path.to_s
      else
        "/" + path.to_s
      end
      
    end
826391
function getFilePathRelativeToAppRoot (pPath) {
    // go to meow-blog directory
    var projectBaseDirectory = path.resolve(__dirname, '..');

    if (projectBaseDirectory.indexOf('node_modules') !== -1) {
        // from meow-blog, go up to node_modules, then go to base directory
        projectBaseDirectory = path.resolve(projectBaseDirectory, '..', '..');
    }

    return path.resolve(projectBaseDirectory, pPath);
}
1343983
def get_relative_path(self, root):
        
        if self.path == root:
            return ''
        ancestors = self.ancestors(stop=root)
        return functools.reduce(lambda f, p: Folder(p.name).child(f),
                                ancestors,
                                self.name)
1351737
def relative_path
      @rel_path ||= begin 
        date_array = id.split("-")[0..2]
        date_path = date_array.join("/")
        article_id = begin
          str = id.gsub date_array.join("-"), ''
          if str[0] == "-"
            str[1..-1] 
          else
            str
          end
        end
        "#{category}/#{date_path}/#{article_id}"
      end
    end
796105
function findAppPath() {
    if (oars._appPath) return oars._appPath;

    var cwd = process.cwd();
    var argv = process.argv;

    var index = _.findIndex(argv, function(value) {
      return _.startsWith(value, cwd);
    });

    if (index === -1) {
      return cwd;
    } else {
      return path.dirname(argv[index]);
    }
  }
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
1034540
def _relative(self, uri):
        

        if uri.startswith("http:") or \
           uri.startswith("https:") or \
           uri.startswith("file:") or \
           uri.startswith("/"):
            return uri

        elif exists(uri):
            return relpath(uri, self.basedir)

        else:
            return uri
847264
def rel_path(*file_path):
        '''
        
        '''
        if hasattr(sys, 'frozen'):
            if file_path[0] == '__file__':
                return sys.executable
            return os.path.join(os.path.dirname(sys.executable), *file_path)
        else:
            try:
                main_file = AppBuilder.main_file
            except AttributeError:
                # The first call setting up the instance
                main_file = inspect.stack()[1][1]
            if file_path[0] == '__file__':
                return os.path.realpath(main_file)
            return os.path.join(os.path.dirname(main_file), *file_path)