Logo Search packages:      
Sourcecode: wallpaper-tray version File versions  Download package

void Wallpapers::GetDirectoryEntryAtIndex ( fs::path  _pathCurrent,
std::size_t &  _nFileIndex,
Glib::ustring &  _szFile 
) [private]

Recursive method, treats all monitored folders as one, and finds the file at _nFileIndex.

<Wallpapers::CountDirectoryEntries>

Parameters:
_pathCurrent Boost path giving the current directory/path in recursion.
_nFileCount Number of files the algorithm has yet to pass.
_szFile An out parameter that gives the resulting file name.
Date:
12-06-2006 GAF Written

Definition at line 345 of file Wallpapers.cc.

Referenced by SetRandom().

{
      fs::directory_iterator itEnd;

      if(_nFileIndex == 0)
      {
            return;
      }// end if

      for(fs::directory_iterator it(_pathCurrent); it != itEnd && _nFileIndex != 0; ++ it)
      {
            try
            {
                  if(fs::is_directory(*it))
                  {
                        if(fs::symbolic_link_exists(*it))
                        {
                              if(m_pGconfClient->get_bool("/apps/wp_tray/b_follow_links") == true)
                              {
                                    // recurse
                                    Wallpapers::GetDirectoryEntryAtIndex(*it, _nFileIndex, _szFile);
                              }// end if
                        }// end if
                        else
                        {
                              // recurse
                              Wallpapers::GetDirectoryEntryAtIndex(*it, _nFileIndex, _szFile);
                        }// end else
                  }// end if
                  else
                  {
                        if(!m_pGconfClient->get_bool("/apps/wp_tray/b_img_check") || boost::regex_match(it->leaf(), m_regexImageCheck))
                        {
                              if(-- _nFileIndex == 0)
                              {
#if BOOST_VERSION > 103301
                                    _szFile = it->path().directory_string();
#else
                                    _szFile = (*it).native_directory_string();
#endif
                              }// end if
                        }// end if
                  }// end else
            }// end try
            catch(const std::exception & ex)
            {
                  std::cerr << "Wallpapers::GetDirectoryEntryAtIndex() : " << it->leaf() << " " << ex.what() << std::endl;
            }// end catch
      }// end for
}// end Wallpapers::GetDirectoryEntryAtIndex


Generated by  Doxygen 1.6.0   Back to index