Process a resource

@param string $manifestroot
@param string $fname
@param string $folder
358957
public function process_resource($manifestroot, &$fname, $folder) {
        $file = empty($folder) ? $manifestroot.'/'.$fname : $manifestroot.'/'.$folder.'/'.$fname;
        if (!file_exists($file) && $this->throwonerror) {
            throw new Exception('The file doesnt exist!');
        }

        GetDepFiles($manifestroot, $fname, $this->folder, $this->files);
        array_unshift($this->files, $folder.$fname);
        $this->init_empty_new();
        $this->href             = $folder.$fname;
        $this->identifierref    = $folder.$fname;
        $this->filename         = $fname;
        $this->isempty          = false;
        $this->folder           = $folder;
    }
1371658
function processFile(fPath, context) {
    if (context.included[fPath])
        return;
    context.included[fPath] = true;

    var relPath = path.relative(context.root, fPath);
    context.write("/* " + relPath + ": begin [depth " + context.includeStack.length + "] */\n", "utf-8");
    context.includeStack.push(relPath);

    var parsedFile = context.filetype.parse(fPath);
    parsedFile.forEach(function(item) {
        if (Buffer.isBuffer(item)) {
            context.write(item);
            return;
        }
        try {
            context.filetype.process(fPath, item, context);
        } catch(ex) {
            console.error("------------");
            console.error(JSON.stringify(item));
            throw ex;
        }
    });

    context.includeStack.pop();
    context.write("/* " + relPath + ": end */\n", "utf-8");

    return parsedFile;
}
609929
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      try
      {
         populateMemberData(reader, file, root);
         processProjectProperties();

         if (!reader.getReadPropertiesOnly())
         {
            processSubProjectData();
            processGraphicalIndicators();
            processCustomValueLists();
            processCalendarData();
            processResourceData();
            processTaskData();
            processConstraintData();
            processAssignmentData();
            postProcessTasks();

            if (reader.getReadPresentationData())
            {
               processViewPropertyData();
               processTableData();
               processViewData();
               processFilterData();
               processGroupData();
               processSavedViewState();
            }
         }
      }

      finally
      {
         clearMemberData();
      }
   }
508366
private function describeManifest(ManifestInterface $manifest, OutputInterface $output)
    {
        $builder = new ProcedureBuilder();
        $manifest->configureProcedureBuilder($builder);

        $output->writeln(sprintf("Manifest description for <info>%s</info>\n", $manifest->getName()));
        $output->writeln("<fg=blue;options=bold>PROCEDURE CONFIGURATION</fg=blue;options=bold>\n");

        $this->describeProcedure($builder->getProcedure(), $output);
    }
585789
function(dirPath, callback) {
            client
                .createDirectory(dirPath)
                .then(function() {
                    __executeCallbackAsync(callback, [null]);
                })
                .catch(callback);
        }
813600
@Override
    public ManifestDescriptor fromFile(File file) throws IllegalArgumentException, DescriptorImportException {
        if (file == null)
            throw new IllegalArgumentException("File cannot be null");

        try {
            return new ManifestDescriptorImpl(descriptorName, new ManifestModel(file));
        } catch (Exception e) {
            throw new DescriptorImportException(e.getMessage(), e);
        }
    }
933927
public function import_resource(DOMElement &$node, cc_i_manifest &$doc) {

        $searchstr = "//imscc:manifest[@identifier='".$doc->manifestID().
                     "']/imscc:resources/imscc:resource";
        $this->identifier   = $this->get_attr_value($node, "identifier");
        $this->type         = $this->get_attr_value($node, "type");
        $this->href         = $this->get_attr_value($node, "href");
        $this->base         = $this->get_attr_value($node, "base");
        $this->persiststate = null;
        $nodo               = $doc->nodeList($searchstr."[@identifier='".
                              $this->identifier."']/metadata/@href");
        $this->metadata     = $nodo->nodeValue;
        $this->filename     = $this->href;
        $nlist              = $doc->nodeList($searchstr."[@identifier='".
                              $this->identifier."']/imscc:file/@href");
        $this->files        = array();
        foreach ($nlist as $file) {
            $this->files[]  = $file->nodeValue;
        }
        $nlist              = $doc->nodeList($searchstr."[@identifier='".
                              $this->identifier."']/imscc:dependency/@identifierref");
        $this->dependency   = array();
        foreach ($nlist as $dependency) {
            $this->dependency[]  = $dependency->nodeValue;
        }
        $this->isempty      = false;
    }
1076356
protected function buildComposerCommands($manifestPath, array $options)
    {
        if (!isset($options['composerCommandPath'])) {
            throw new TaskExecutionException('Composer command not found. Set the composerCommandPath option.', 1349163257);
        }

        $additionalArguments = [];
        if (isset($options['additionalArguments'])) {
            $additionalArguments = (array)$options['additionalArguments'];
        }

        $arguments = array_merge(
            [escapeshellcmd($options['composerCommandPath']), $this->command],
            $this->arguments,
            array_map('escapeshellarg', $additionalArguments),
            $this->suffix
        );
        $script = implode(' ', $arguments);

        return [
            'cd ' . escapeshellarg($manifestPath),
            $script,
        ];
    }
865062
public function process($filename, $actualFileName)
    {
        // Check if the processing should be done
        if(!$this->shouldProcess($filename))
        {
            // No need to process the file, so bypass
            return $this->getFinalName($filename);
        }

        // Read the contents of the JavaScript file
        $js = file_get_contents($filename);

        // Otherwise write the file and return the new file name
        return $this->write(Minify::minify($js), $actualFileName);
    }
489681
public static function findRecursiveCallback( ezpAutoloadFileFindContext $context, $sourceDir, $fileName, $fileInfo )
    {
        if ( $fileInfo['mode'] & 0x4000 )
        {
            return;
        }

        // update the statistics
        $context->elements[] = $sourceDir . DIRECTORY_SEPARATOR . $fileName;
        $context->count++;

        $context->generator->updateProgressOutput( eZAutoloadGenerator::OUTPUT_PROGRESS_PHASE1 );
    }
448254
public function process($filename, $actualFileName)
    {
        // Check if the processing should be done
        if(!$this->shouldProcess($filename))
        {
            // No need to process the file, so bypass
            return $this->getFinalName($filename);
        }

        // Get an instance of the LESS compiler
        $less = new lessc();

        // Otherwise write the file and return the new file name
        return $this->write($less->compileFile($filename), $actualFileName);
    }
1257603
function parseManifest(manifest, docroot, callback)
{
  var inCache = false
    , lines = [];

    // get manifest file data
    fs.readFile(manifest, 'ascii', function(err, data)
    {
      var counter = 0;

      if (err)
      {
        // to prevent sudden continuation
        return callback(err);
      }

      cache[manifest] =
      {
        version: 0,
        files: [],
        manifest: data
      };

      lines = data.split('\n');

      lines.forEach(function(line)
      {
        var match;

        line = line.trim();

        // empty lines
        if (line.substr(0, 1) == '') return;

        // skip comments
        if (line.substr(0, 1) == '#') return;

        // process control keywords
        switch (line)
        {
          case 'CACHE MANIFEST':
          case 'CACHE:':
            inCache = true;
            return;
            break;

          // TODO: Add proper support for fallbacks
          case 'NETWORK:':
          case 'FALLBACK:':
            inCache = false;
            return;
            break;
        }

        // do nothing for network files
        if (!inCache) return;

        // check the file and setup monitoring
        if (!line.match(/^http(s)?:\/\//))
        {
          addWatcher(docroot+line, watcher(manifest), function(added, mtime)
          {
            // undo counter
            counter--;

            if (!added)
            {
              // check if everything is done
              if (counter == 0) callback();
              return;
            }

            if (mtime > cache[manifest].version) cache[manifest].version = mtime;

            cache[manifest].files.push(line);

            // check if everything is done
            if (counter == 0) callback();
          });

          // track inception
          counter++;
        }

      });
    });
}
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();
    }
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;
    }
861858
static void processRoot(final File root, final ProcessedLayers layers, final LayerPathSetter setter) throws IOException {
        final LayersConfig layersConfig = LayersConfig.getLayersConfig(root);
        // Process layers
        final File layersDir = new File(root, layersConfig.getLayersPath());
        if (!layersDir.exists()) {
            if (layersConfig.isConfigured()) {
                // Bad config from user
                throw PatchLogger.ROOT_LOGGER.installationNoLayersConfigFound(layersDir.getAbsolutePath());
            }
            // else this isn't a root that has layers and add-ons
        } else {
            // check for a valid layer configuration
            for (final String layer : layersConfig.getLayers()) {
                File layerDir = new File(layersDir, layer);
                if (!layerDir.exists()) {
                    if (layersConfig.isConfigured()) {
                        // Bad config from user
                        throw PatchLogger.ROOT_LOGGER.installationMissingLayer(layer, layersDir.getAbsolutePath());
                    }
                    // else this isn't a standard layers and add-ons structure
                    return;
                }
                layers.addLayer(layer, layerDir, setter);
            }
        }
        // Finally process the add-ons
        final File addOnsDir = new File(root, layersConfig.getAddOnsPath());
        final File[] addOnsList = addOnsDir.listFiles();
        if (addOnsList != null) {
            for (final File addOn : addOnsList) {
                layers.addAddOn(addOn.getName(), addOn, setter);
            }
        }
    }
1193291
public void handleBrowseRootFolder() {
		DirectoryDialog dialog = new DirectoryDialog (getShell());
		String platform = SWT.getPlatform();
		dialog.setFilterPath (platform.equals("win32") || platform.equals("wpf") ? "c:\\" : "/");

		String foldername = dialog.open();
		System.err.println("RESULT ROOT_FOLDER = " + foldername);
		rootFolderText.setText(foldername);		
	}
752207
@Override
    public void onNewFolder(@NonNull String name) {
        AsyncTask<String, Void, FtpFile> task = new AsyncTask<String, Void, FtpFile>() {

            @Override
            protected FtpFile doInBackground(String... names) {
                FtpFile result = null;
                if (names.length > 0) {
                    result = onNewFolderAsync(names[0]);
                }
                return result;
            }

            @Override
            protected void onPostExecute(FtpFile folder) {
                if (folder != null) {
                    refresh(folder);
                } else {
                    Toast.makeText(getContext(), R.string.nnf_create_folder_error, Toast.LENGTH_SHORT).show();
                }
            }
        };
        task.execute(name);
    }