Changeset 24035


Ignore:
Timestamp:
10/03/13 09:08:09 (9 years ago)
Author:
nit
Message:

[titan] first step for more then one pluginpath

Location:
titan
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/catcatch/catcatch.c

    r17097 r24035  
    2323        char* tmpstr = NULL;
    2424
    25         tmpstr = ostrcat(getconfig("pluginpath", NULL), "/catcatch/skin.xml", 0, 0);
     25        tmpstr = createpluginpath("/catcatch/skin.xml", 0);
    2626        readscreen(tmpstr, 241, 1);
    2727        free(tmpstr); tmpstr = NULL;
  • titan/titan/global.h

    r23991 r24035  
    11#ifndef GLOBAL_H
    22#define GLOBAL_H
     3
     4//flag 0: get pluginpath an add text
     5//flag 1: get pluginpath and change "%pluginpath%/"
     6char* createpluginpath(char* text, int flag)
     7{
     8        char* tmpstr = NULL;
     9        if(text == NULL) return NULL;
     10       
     11        if(flag == 0)
     12        {
     13          tmpstr = ostrcat(getconfig("pluginpath", NULL), text, 0, 0);
     14          if(file_exist(tmpstr) == 1) return tmpstr;
     15         
     16          free(tmpstr); tmpstr = NULL;
     17          tmpstr = ostrcat(getconfig("pluginpath1", NULL), text, 0, 0);
     18          if(file_exist(tmpstr) == 1) return tmpstr;
     19         
     20          free(tmpstr); tmpstr = NULL;
     21          tmpstr = ostrcat(getconfig("pluginpath2", NULL), text, 0, 0);
     22          if(file_exist(tmpstr) == 1) return tmpstr;
     23         
     24          return NULL;
     25        }
     26        else
     27        {
     28                if(strlen(text) < 13) return NULL;
     29               
     30                tmpstr = ostrcat(getconfig("pluginpath", NULL), &text[13]);
     31                if(file_exist(tmpstr) == 1) return tmpstr;
     32               
     33                free(tmpstr); tmpstr = NULL;
     34                tmpstr = ostrcat(getconfig("pluginpath1", NULL), &text[13]);
     35                if(file_exist(tmpstr) == 1) return tmpstr;
     36               
     37                free(tmpstr); tmpstr = NULL;
     38                tmpstr = ostrcat(getconfig("pluginpath2", NULL), &text[13]);
     39                if(file_exist(tmpstr) == 1) return tmpstr;
     40        }
     41       
     42        return NULL;
     43}
    344
    445int osystem(char* cmd, int timeout)
     
    16921733}
    16931734
     1735//flag 0: normal picons
     1736//flag 1: alternate picons
    16941737char* createpiconpath(struct channel* chnode, int flag)
    16951738{
  • titan/titan/plugin.h

    r23411 r24035  
    218218        char *tmppath = NULL;
    219219
     220        //pluginpath
    220221        tmppath = getconfig("pluginpath", NULL);
    221222
     
    252253        free(filelist);
    253254       
    254        
    255         // 2. plugindir
    256         tmppath = getconfig("pluginpath_2", NULL);
     255        //pluginpath1
     256        tmppath = getconfig("pluginpath1", NULL);
    257257
    258258        if(tmppath == NULL)
     
    262262        if(count < 0)
    263263        {
    264                 perr("scandir_2");
     264                perr("scandir1");
     265                return 0;
     266        }
     267
     268        while(count--)
     269        {
     270                //check if link is a dir
     271                if(filelist[count]->d_type == DT_LNK || filelist[count]->d_type == DT_UNKNOWN)
     272                {
     273                        tmpstr = createpath(tmppath, filelist[count]->d_name);
     274                        if(isdir(tmpstr) == 1)
     275                                filelist[count]->d_type = DT_DIR;
     276
     277                        free(tmpstr); tmpstr = NULL;
     278                }
     279
     280                if(filelist[count]->d_type == DT_DIR && ostrcmp(filelist[count]->d_name, ".") != 0 && ostrcmp(filelist[count]->d_name, "..") != 0)
     281                {
     282                        pluginpath = createpath(tmppath, filelist[count]->d_name);
     283                        readplugin(pluginpath);
     284                        free(pluginpath); pluginpath = NULL;
     285                }
     286                free(filelist[count]);
     287        }
     288        free(filelist);
     289       
     290        //pluginpath2
     291        tmppath = getconfig("pluginpath2", NULL);
     292
     293        if(tmppath == NULL)
     294                return 0;
     295
     296        count = scandir(tmppath, &filelist, 0, 0);
     297        if(count < 0)
     298        {
     299                perr("scandir2");
    265300                return 0;
    266301        }
  • titan/titan/skin.h

    r23991 r24035  
    478478        {
    479479                if(ostrstr(picname, "%pluginpath%/") != NULL)
    480                 {
    481                         tmpstr = createpath(getconfig("pluginpath", NULL), &picname[13]);
    482                 }
     480                        tmpstr = createpluginpath(picname, 1);
    483481                else
    484482                        tmpstr = createpath(getconfig("skinpath", NULL), picname);
Note: See TracChangeset for help on using the changeset viewer.