Menu

exlude files

2006-11-15
2013-03-21
  • alex schmid

    alex schmid - 2006-11-15

    Hello,

    first, thanks for the nice filebrowser.

    One feature i missed was a way to hide some parts of the filesystem, so i put it in on my own based on regular expressions.

    In the configuration-file add a line like this:
    browser.entries.hide=prepared,.*~$,help,admin*,\.\.

    this will hide a directory 'prepared' (from sigma template engine), all temporary saves of emacs, help, all entries starting with admin and the ..-entry in root.
    note that regular expressions should be escaped there and these are relatives paths from 'root', subdirectories work.

    in the file Browser.php add after:

    ca. line 369:
    $list = $this->getListOfEntries( $currentLocation );

    // check if entry should be hidden
    $hiddenEntries = Browser_Utilities :: getValueFromConfiguration("browser.entries.hide");
    $arrayHiddenEntries = split (',',$hiddenEntries);

    ca. line 383:
    $pathToEntry = $currentLocation.Browser_Utilities :: getSeparator().$entry;
    $relativePathToEntry = substr($relativePath.Browser_Utilities :: getSeparator().$entry,1);

    ca. line 390:
            // skip that entry
            continue;
            }

            $stop = 0;
            foreach ($arrayHiddenEntries AS $exclude) {
                $expr = '!^'.$exclude.'!';
                preg_match($expr,$relativePathToEntry,$match);
                if (count($match)==1) {
                    $stop = 1;
                }
            }
            if ($stop==1) continue;

    finaly replace ca. line 407 (not really necessary):
                $entryObj->relativePath = $relativePathToEntry;
    with
                $entryObj->relativePath = substr($relativePath.Browser_Utilities :: getSeparator().$entry,1); ;

    Would be nice to see these changes/this function in one of the next releases.

    Enjoy,
    Alex

     
    • Marek Blotny

      Marek Blotny - 2006-11-16

      Hi Alex,

      Thanks for interesting suggestion and code snippet! A really like the idea of heaving option which allows you can define which directories/files should be hidden. It’s easily conceivable that it might be handy in many cases. For sure I’ll enclose this feature in next release.

      Cheers, Marek

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.