[gephex-devel] gephex--main--0.4--patch-1829

gephex at sonnenland.kexbox.org gephex at sonnenland.kexbox.org
Thu Jan 6 09:56:33 CET 2005


Archive: gephex at gephex.org--2004
New revision: gephex--main--0.4--patch-1829

--
Revision: gephex--main--0.4--patch-1829
Archive: gephex at gephex.org--2004
Creator: The Gephex Source Archive <gephex at gephex.org>
Date: Thu Jan  6 09:56:32 CET 2005
Standard-date: 2005-01-06 08:56:32 GMT
Modified-files: base/src/utils/filesystem.cpp
    engine/src/engine/controller.cpp
    engine/src/engine/main.cpp
New-patches: georg at gephex.org--2004-home/gephex--georg--0.4--patch-374
    gephex at gephex.org--2004/gephex--main--0.4--patch-1829
Summary: [MERGE-REQUEST] fixed bug #71 (frei0r_path now optional)
Keywords: 

Patches applied:

 * georg at gephex.org--2004-home/gephex--georg--0.4--patch-374
   Made frei0r_path parameter optional, made directory opening not throw on failure but only warn

* added files

    {arch}/gephex/gephex--georg/gephex--georg--0.4/georg at gephex.org--2004-home/patch-log/patch-374
    {arch}/gephex/gephex--main/gephex--main--0.4/gephex at gephex.org--2004/patch-log/patch-1829

* modified files

--- orig/base/src/utils/filesystem.cpp
+++ mod/base/src/utils/filesystem.cpp
@@ -108,7 +108,7 @@
 	
   /* Find first .c file in current directory */
   if( (hFile = _findfirst( spec.c_str(), &c_file )) == -1 )
-    throw std::runtime_error(std::string("Could not open directory")+spec);
+    throw std::runtime_error(std::string("Could not open directory ")+spec);
 	
   do
     {
@@ -126,7 +126,7 @@
 #elif defined(OS_POSIX)
   DIR* dstream = opendir(path.c_str());
   if (dstream == 0)
-    throw std::runtime_error(std::string("Could not open directory")+path);
+    throw std::runtime_error(std::string("Could not open directory ")+path);
 
   dirent* current = readdir(dstream);
   while (current != 0)


--- orig/engine/src/engine/controller.cpp
+++ mod/engine/src/engine/controller.cpp
@@ -48,7 +48,7 @@
   public:
     Acceptor(net::IServerSocket& serverSocket, net::ISocket*& socket);
     bool run();
-      
+     
   private:
     net::IServerSocket* m_serverSocket;
     net::ISocket** m_socket;
@@ -121,23 +121,30 @@
   std::vector<std::string> getFilesInDir(const std::string& dirName,
 					 const std::string& ending)
   {
-    std::list<utils::DirEntry> entries;
-    utils::FileSystem::listDir(dirName, entries);
-    
     std::vector<std::string> fileNames;
     
-    for (std::list<utils::DirEntry>::const_iterator it = entries.begin();
-	 it != entries.end(); ++it)
+    try
       {
-        std::string name = it->getName();
+        std::list<utils::DirEntry> entries;
+        utils::FileSystem::listDir(dirName, entries);
+    
+        for (std::list<utils::DirEntry>::const_iterator it = entries.begin();
+             it != entries.end(); ++it)
+          {
+            std::string name = it->getName();
       
-        if (name.length() > ending.length() 
-            && name.substr(name.length()-ending.length(),
-                           ending.length()) == ending)
-	
-          fileNames.push_back(dirName + name);
+            if (name.length() > ending.length() 
+                && name.substr(name.length()-ending.length(),
+                               ending.length()) == ending)
+              
+              fileNames.push_back(dirName + name);
+          }
+      }
+    catch (std::runtime_error& e)
+      {
+        std::cerr << "Could not open '" << dirName << "' ("
+                  << e.what() << ")
";
       }
-    
     return fileNames;
   }
   
@@ -319,9 +326,9 @@
 
 
     std::string frei0r_path = config.get_string_param("frei0r_path");
-    std::vector<std::string> frei0rs = getFilesInDir(frei0r_path,
-						     MODULE_ENDING);
-
+    std::vector<std::string> frei0rs;
+    if (frei0r_path != "")
+      frei0rs = getFilesInDir(frei0r_path, MODULE_ENDING);
     
     std::cout << "Reading plugins...";
     std::cout.flush();


--- orig/engine/src/engine/main.cpp
+++ mod/engine/src/engine/main.cpp
@@ -203,11 +203,12 @@
                                    "Directory that contains gephex modules",
                                       0));
 
+      def.s = "";
       params.push_back(config_param_t("frei0r_path",
 				      config_param_t::STRING_PARAM,
 				      "engine",
 				      "Directory that contains frei0r effects",
-                                      0));
+                                      &def));
 
       params.push_back(config_param_t("type_path",
                                    config_param_t::STRING_PARAM,



More information about the gephex-devel mailing list