Load the last (most recent) checkpoint from the specified root directory
@param rootDir Root directory to load checpoint from
@return MultiLayerNetwork for last checkpoint
431855
public static MultiLayerNetwork loadLastCheckpointMLN(File rootDir){
        Checkpoint last = lastCheckpoint(rootDir);
        return loadCheckpointMLN(rootDir, last);
    }
1164373
private String getStoredBundlePath(String rootDir, String bundleName) {
		if (bundleName.indexOf('/') != -1) {
			bundleName = bundleName.replace('/', File.separatorChar);
		}

		if (!bundleName.startsWith(File.separator)) {
			rootDir += File.separator;
		}

		return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName);
	}
1225467
public static final CClassLoader getRootLoader() {
		if (CClassLoader.rootLoader == null) {
			CClassLoader.rootLoader = CClassLoader.createLoader(
					CClassLoader.class.getClassLoader(),
					CClassLoader.ROOT_LOADER);
		}
		return CClassLoader.rootLoader;
	}
754393
@NonNull
    @Override
    public Loader<SortedList<File>> getLoader() {
        return new AsyncTaskLoader<SortedList<File>>(getActivity()) {

            FileObserver fileObserver;

            @Override
            public SortedList<File> loadInBackground() {
                File[] listFiles = mCurrentPath.listFiles();
                final int initCap = listFiles == null ? 0 : listFiles.length;

                SortedList<File> files = new SortedList<>(File.class, new SortedListAdapterCallback<File>(getDummyAdapter()) {
                    @Override
                    public int compare(File lhs, File rhs) {
                        return compareFiles(lhs, rhs);
                    }

                    @Override
                    public boolean areContentsTheSame(File file, File file2) {
                        return file.getAbsolutePath().equals(file2.getAbsolutePath()) && (file.isFile() == file2.isFile());
                    }

                    @Override
                    public boolean areItemsTheSame(File file, File file2) {
                        return areContentsTheSame(file, file2);
                    }
                }, initCap);


                files.beginBatchedUpdates();
                if (listFiles != null) {
                    for (java.io.File f : listFiles) {
                        if (isItemVisible(f)) {
                            files.add(f);
                        }
                    }
                }
                files.endBatchedUpdates();

                return files;
            }

            /**
             * Handles a request to start the Loader.
             */
            @Override
            protected void onStartLoading() {
                super.onStartLoading();

                // handle if directory does not exist. Fall back to root.
                if (mCurrentPath == null || !mCurrentPath.isDirectory()) {
                    mCurrentPath = getRoot();
                }

                // Start watching for changes
                fileObserver = new FileObserver(mCurrentPath.getPath(),
                        FileObserver.CREATE |
                                FileObserver.DELETE
                                | FileObserver.MOVED_FROM | FileObserver.MOVED_TO
                ) {

                    @Override
                    public void onEvent(int event, String path) {
                        // Reload
                        onContentChanged();
                    }
                };
                fileObserver.startWatching();

                forceLoad();
            }

            /**
             * Handles a request to completely reset the Loader.
             */
            @Override
            protected void onReset() {
                super.onReset();

                // Stop watching
                if (fileObserver != null) {
                    fileObserver.stopWatching();
                    fileObserver = null;
                }
            }
        };
    }
1012709
public function getRootDir()
    {
        if (!is_null($this->rootDirPrefix)) {
            return $this->rootDirPrefix;
        }

        $bundles = array_map(function ($bundle) {
            return is_object($bundle)
                ? get_class($bundle)
                : $bundle;
        }, $this->bundlesToLoad);
        $config = $this->configuration;
        $routes = $this->routes;
        sort($bundles);
        sort($routes);
        $this->sortArray($config);

        return sys_get_temp_dir().'/base-kernel/'.'kernel-'.(
            hash(
                'md5',
                json_encode([
                    $bundles,
                    $config,
                    $routes,
                ])
            )
        );
    }
910149
private boolean setupPipelineForAppend(LocatedBlock lastBlock) throws IOException {
    if (nodes == null || nodes.length == 0) {
      String msg = "Could not get block locations. " +
          "Source file \"" + src
          + "\" - Aborting...";
      DFSClient.LOG.warn(msg);
      setLastException(new IOException(msg));
      closed = true;
      if (streamer != null) streamer.close();
      return false;
    }
    
    boolean success = createBlockOutputStream(nodes, dfsClient.clientName, false, true);
    long oldGenerationStamp = 
        ((LocatedBlockWithOldGS)lastBlock).getOldGenerationStamp();
    
    if (success) {
      // bump up the generation stamp in NN.
      Block newBlock = lastBlock.getBlock();
      Block oldBlock = new Block(newBlock.getBlockId(), newBlock.getNumBytes(), 
          oldGenerationStamp);
      dfsClient.namenode.updatePipeline(dfsClient.clientName, 
          oldBlock, newBlock, nodes);
    } else {
      DFSClient.LOG.warn("Fall back to block recovery process when trying" +
          " to setup the append pipeline for file " + src);
      // set the old generation stamp 
      block.setGenerationStamp(oldGenerationStamp);
      // fall back the block recovery
      while(processDatanodeError(true, true)) {
        try {
          Thread.sleep(1000);
        } catch (InterruptedException  e) {
          lastException = new IOException(e);
          break;
        }
      }
    }
    return success;
  }
46249
def next_root_lft
      last_root = nested_interval_scope.roots.order( rgtp: :desc, rgtq: :desc ).first
      raise Exception.new("Only one root allowed") if last_root.present? && !self.class.nested_interval.multiple_roots?
      last_root.try(:right) || 0.to_r
    end
188851
public static MultiLayerNetwork loadCheckpointMLN(File rootDir, int checkpointNum){
        File f = getFileForCheckpoint(rootDir, checkpointNum);
        try {
            return ModelSerializer.restoreMultiLayerNetwork(f, true);
        } catch (IOException e){
            throw new RuntimeException(e);
        }
    }
1296500
public ITreeData getNode() {
        if (lastPointer.get(mRTX) != null && lastPointer.get(mRTX) < 0) {
            return atomics.get(mRTX).getItem(lastPointer.get(mRTX));
        } else {
            return mRTX.getNode();
        }
    }
1133871
@Override
	protected void openConnectionInternal() throws ConnectionException, AuthenticationException {
		if (checkoutDirectory == null) {
			checkoutDirectory = createCheckoutDirectory();
		}

		if (checkoutDirectory.exists() && safeCheckout) {
			removeCheckoutDirectory();
		}

		checkoutDirectory.mkdirs();
	}
525921
@NonNull
    @Override
    public Loader<SortedList<FtpFile>> getLoader() {
        return new AsyncTaskLoader<SortedList<FtpFile>>(getContext()) {
            @Override
            public SortedList<FtpFile> loadInBackground() {
                SortedList<FtpFile> sortedList = new SortedList<>(FtpFile.class, new SortedListAdapterCallback<FtpFile>(getDummyAdapter()) {
                    @Override
                    public int compare(FtpFile lhs, FtpFile rhs) {
                        if (lhs.isDirectory() && !rhs.isDirectory()) {
                            return -1;
                        } else if (rhs.isDirectory() && !lhs.isDirectory()) {
                            return 1;
                        } else {
                            return lhs.getName().compareToIgnoreCase(rhs.getName());
                        }
                    }

                    @Override
                    public boolean areContentsTheSame(FtpFile oldItem, FtpFile newItem) {
                        return oldItem.getName().equals(newItem.getName());
                    }

                    @Override
                    public boolean areItemsTheSame(FtpFile item1, FtpFile item2) {
                        return item1.getName().equals(item2.getName());
                    }
                });


                if (!ftp.isConnected()) {
                    // Connect
                    try {
                        ftp.connect(server, port);

                        ftp.setFileType(FTP.ASCII_FILE_TYPE);
                        ftp.enterLocalPassiveMode();
                        ftp.setUseEPSVwithIPv4(false);

                        if (!(loggedIn = ftp.login(username, password))) {
                            ftp.logout();
                            Log.e(TAG, "Login failed");
                        }
                    } catch (IOException e) {
                        if (ftp.isConnected()) {
                            try {
                                ftp.disconnect();
                            } catch (IOException ignored) {
                            }
                        }
                        Log.e(TAG, "Could not connect to server.");
                    }
                }

                if (loggedIn) {
                    try {
                        // handle if directory does not exist. Fall back to root.
                        if (mCurrentPath == null || !mCurrentPath.isDirectory()) {
                            mCurrentPath = getRoot();
                        }

                        sortedList.beginBatchedUpdates();
                        for (FTPFile f : ftp.listFiles(mCurrentPath.getPath())) {
                            FtpFile file;
                            if (f.isDirectory()) {
                                file = new FtpDir(mCurrentPath, f.getName());
                            } else {
                                file = new FtpFile(mCurrentPath, f.getName());
                            }
                            if (isItemVisible(file)) {
                                sortedList.add(file);
                            }
                        }
                        sortedList.endBatchedUpdates();
                    } catch (IOException e) {
                        Log.e(TAG, "IOException: " + e.getMessage());
                    }
                }

                return sortedList;
            }

            /**
             * Handles a request to start the Loader.
             */
            @Override
            protected void onStartLoading() {
                super.onStartLoading();

                // handle if directory does not exist. Fall back to root.
                if (mCurrentPath == null || !mCurrentPath.isDirectory()) {
                    mCurrentPath = getRoot();
                }

                forceLoad();
            }
        };
    }
544122
Path getRootDirectory()
  {
    Path rawRoot = config().get("baratine.root", Path.class, 
                                Paths.get("/tmp/baratine"));

    return rawRoot;
  }
855386
public static PoliciesCache fromDir(File rootDir, final Set<Attribute> forcedContext) {
        return fromSourceProvider(YamlProvider.getDirProvider(rootDir),forcedContext);
    }
1281275
private void loadRootFolder() {
        new Thread() {
            @Override
            public void run() {
                try {
                    //Api to fetch root folder
                    final BoxIteratorItems folderItems = mFolderApi.getItemsRequest(BoxConstants.ROOT_FOLDER_ID).send();
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            mAdapter.clear();
                            for (BoxItem boxItem: folderItems) {
                                mAdapter.add(boxItem);
                            }
                        }
                    });
                } catch (BoxException e) {
                    e.printStackTrace();
                }

            }
        }.start();
    }
1371307
protected function setConnectionRoot()
    {
        $root = $this->getRoot();
        $connection = $this->connection;

        if ($root && ! ftp_chdir($connection, $root)) {
            throw new RuntimeException('Root is invalid or does not exist: ' . $this->getRoot());
        }

        // Store absolute path for further reference.
        // This is needed when creating directories and
        // initial root was a relative path, else the root
        // would be relative to the chdir'd path.
        $this->root = ftp_pwd($connection);
    }
879534
private function loadAndParseFile($fileName, $rootDir)
    {
        if (!$this->configuration->isRemoteFileInclusionEnabled()) {
            $rootDir = \realpath($rootDir);
            $fullPath = \realpath($rootDir . '/' . $fileName);

            if (!\is_readable($fullPath)) {
                throw new FileNotFoundException($fileName);
            }
        } else {
            $fullPath = $rootDir . '/' . $fileName;
            if (!\filter_var($fullPath, FILTER_VALIDATE_URL) && !\is_readable($fullPath)) {
                throw new FileNotFoundException($fileName);
            }
        }

        // Prevent LFI directory traversal attacks
        if (!$this->configuration->isDirectoryTraversalAllowed() &&
            \substr($fullPath, 0, \strlen($rootDir)) !== $rootDir
        ) {
            throw new FileNotFoundException($fileName);
        }

        $cacheKey = \md5($fullPath);

        // cache based on file name, prevents including/parsing the same file multiple times
        if (isset($this->cachedFiles[$cacheKey])) {
            return $this->cachedFiles[$cacheKey];
        }

        $fileExtension = (\pathinfo($fileName, PATHINFO_EXTENSION));

        if (\in_array($fileExtension, ['yaml', 'yml', 'raml'], true)) {
            $rootDir = \dirname($rootDir . '/' . $fileName);

            // RAML and YAML files are always parsed
            $fileData = $this->parseRamlString(
                \file_get_contents($fullPath),
                $rootDir
            );
            $fileData = $this->includeAndParseFiles($fileData, $rootDir);
        } else {
            $loader = \array_key_exists($fileExtension, $this->fileLoaders) ? $this->fileLoaders[$fileExtension] : $this->fileLoaders['*'];

            $fileData = $loader->loadFile($fullPath);
            $this->cachedFilesPaths[\md5($fileData)] = $fullPath;
        }

        // cache before returning
        $this->cachedFiles[$cacheKey] = $fileData;

        $this->includedFiles[] = $fullPath;

        return $fileData;
    }
446782
def root_folders
        @root_folders ||= Dir.glob("#{Dir.pwd}/*", File::FNM_DOTMATCH).collect do |f|
          File.basename(f) if File.directory?(f)
        end.reject { |dir| %w(. ..).include?(dir) }.compact!
      end