~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/filesel.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: filesel.c,v 1.35 2004/04/25 15:12:45 zuster Exp $
 
2
 * $Id: filesel.c,v 1.54 2005/06/04 16:22:50 lukep Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
65
65
#include "DNA_image_types.h"
66
66
#include "DNA_ipo_types.h"
67
67
#include "DNA_vfont_types.h"
 
68
#include "DNA_material_types.h"
68
69
#include "DNA_mesh_types.h"
69
70
#include "DNA_object_types.h"
70
71
#include "DNA_texture_types.h"
101
102
 
102
103
#include "mydevice.h"
103
104
#include "blendef.h"
104
 
#include "render.h"
105
105
#include "nla.h"
106
106
 
 
107
#include "BIF_fsmenu.h"  /* include ourselves */
107
108
 
108
109
#if defined WIN32 || defined __BeOS
109
110
        int fnmatch(){return 0;}
118
119
#define FILESELHEAD             60
119
120
#define FILESEL_DY              16
120
121
 
 
122
/* for events */
121
123
#define NOTACTIVE                       0
122
124
#define ACTIVATE                        1
123
125
#define INACTIVATE                      2
 
126
/* for state of file */
 
127
#define ACTIVE                          2
124
128
 
125
129
#define STARTSWITH(x, y) (strncmp(x, y, sizeof(x) - 1) == 0)
126
130
 
131
135
static void active_file_object(struct SpaceFile *sfile);
132
136
static int groupname_to_code(char *group);
133
137
 
 
138
extern void countall(void);
 
139
 
134
140
/* local globals */
135
141
 
136
142
static rcti scrollrct, textrct, bar;
309
315
        }
310
316
        if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
311
317
        if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
312
 
        return (strcasecmp(entry1->relname,entry2->relname));
 
318
        
 
319
        /* make sure "." and ".." are always first */
 
320
        if( strcmp(entry1->relname, ".")==0 ) return (-1);
 
321
        if( strcmp(entry2->relname, ".")==0 ) return (1);
 
322
        if( strcmp(entry1->relname, "..")==0 ) return (-1);
 
323
        
 
324
        return (BLI_strcasecmp(entry1->relname,entry2->relname));
313
325
}
314
326
 
315
327
static int compare_date(const void *a1, const void *a2) 
331
343
        if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
332
344
        if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
333
345
 
334
 
/*
335
 
        if ( entry1->s.st_ctime < entry2->s.st_ctime) return 1;
336
 
        if ( entry1->s.st_ctime > entry2->s.st_ctime) return -1;
337
 
*/
 
346
        /* make sure "." and ".." are always first */
 
347
        if( strcmp(entry1->relname, ".")==0 ) return (-1);
 
348
        if( strcmp(entry2->relname, ".")==0 ) return (1);
 
349
        if( strcmp(entry1->relname, "..")==0 ) return (-1);
 
350
        
338
351
        if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
339
352
        if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
340
 
        else return strcasecmp(entry1->relname,entry2->relname);
 
353
        
 
354
        else return BLI_strcasecmp(entry1->relname,entry2->relname);
341
355
}
342
356
 
343
357
static int compare_size(const void *a1, const void *a2) 
359
373
        if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
360
374
        if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
361
375
 
 
376
        /* make sure "." and ".." are always first */
 
377
        if( strcmp(entry1->relname, ".")==0 ) return (-1);
 
378
        if( strcmp(entry2->relname, ".")==0 ) return (1);
 
379
        if( strcmp(entry1->relname, "..")==0 ) return (-1);
 
380
        
362
381
        if ( entry1->s.st_size < entry2->s.st_size) return 1;
363
382
        if ( entry1->s.st_size > entry2->s.st_size) return -1;
364
 
        else return strcasecmp(entry1->relname,entry2->relname);
 
383
        else return BLI_strcasecmp(entry1->relname,entry2->relname);
365
384
}
366
385
 
367
386
 
375
394
 
376
395
void filesel_statistics(SpaceFile *sfile, int *totfile, int *selfile, float *totlen, float *sellen)
377
396
{
378
 
        int a, len;
 
397
        double len;
 
398
        int a;
379
399
        
380
400
        *totfile= *selfile= 0;
381
401
        *totlen= *sellen= 0;
487
507
#endif
488
508
}
489
509
 
 
510
/* not called when browsing .blend itself */
490
511
void test_flags_file(SpaceFile *sfile)
491
512
{
492
513
        struct direntry *file;
497
518
        for(num=0; num<sfile->totfile; num++, file++) {
498
519
                file->flags= 0;
499
520
                file->type= file->s.st_mode;    /* restore the mess below */ 
500
 
                
 
521
 
501
522
                        /* Don't check extensions for directories */ 
502
 
                if (file->type&S_IFDIR)
 
523
                if (file->type & S_IFDIR)
503
524
                        continue;
504
525
                        
505
526
                if(sfile->type==FILE_BLENDER || sfile->type==FILE_LOADLIB) {
510
531
                                        char name[FILE_MAXDIR+FILE_MAXFILE];
511
532
                                        strcpy(name, sfile->dir);
512
533
                                        strcat(name, file->relname);
 
534
                                        
513
535
                                        /* prevent current file being used as acceptable dir */
514
536
                                        if (BLI_streq(G.main->name, name)==0) {
515
537
                                                file->type &= ~S_IFMT;
543
565
                                        ||      BLI_testextensie(file->relname, ".pict")
544
566
                                        ||      BLI_testextensie(file->relname, ".pntg") //macpaint
545
567
                                        ||      BLI_testextensie(file->relname, ".qtif")
546
 
#ifdef WITH_FREEIMAGE
547
 
                                ||      BLI_testextensie(file->relname, ".jng")
548
 
                                ||      BLI_testextensie(file->relname, ".mng")
549
 
                                ||      BLI_testextensie(file->relname, ".pbm")
550
 
                                ||      BLI_testextensie(file->relname, ".pgm")
551
 
                                ||      BLI_testextensie(file->relname, ".ppm")
552
 
                                ||      BLI_testextensie(file->relname, ".wbmp")
553
 
                                ||      BLI_testextensie(file->relname, ".cut")
554
 
                                ||      BLI_testextensie(file->relname, ".ico")
555
 
                                ||      BLI_testextensie(file->relname, ".koala")
556
 
                                ||      BLI_testextensie(file->relname, ".pcd")
557
 
                                ||      BLI_testextensie(file->relname, ".pcx")
558
 
                                ||      BLI_testextensie(file->relname, ".ras")
559
 
#endif
560
568
                                        ||      BLI_testextensie(file->relname, ".sgi")) {
561
569
                                        file->flags |= IMAGEFILE;                       
562
570
                                }
575
583
                                        ||      BLI_testextensie(file->relname, ".png")
576
584
                                        ||      BLI_testextensie(file->relname, ".iff")
577
585
                                        ||      BLI_testextensie(file->relname, ".lbm")
578
 
#ifdef WITH_FREEIMAGE
579
 
                                ||      BLI_testextensie(file->relname, ".jng")
580
 
                                ||      BLI_testextensie(file->relname, ".mng")
581
 
                                ||      BLI_testextensie(file->relname, ".pbm")
582
 
                                ||      BLI_testextensie(file->relname, ".pgm")
583
 
                                ||      BLI_testextensie(file->relname, ".ppm")
584
 
                                ||      BLI_testextensie(file->relname, ".wbmp")
585
 
                                ||      BLI_testextensie(file->relname, ".cut")
586
 
                                ||      BLI_testextensie(file->relname, ".ico")
587
 
                                ||      BLI_testextensie(file->relname, ".koala")
588
 
                                ||      BLI_testextensie(file->relname, ".pcd")
589
 
                                ||      BLI_testextensie(file->relname, ".pcx")
590
 
                                ||      BLI_testextensie(file->relname, ".ras")
591
 
                                ||      BLI_testextensie(file->relname, ".gif")
592
 
                                ||      BLI_testextensie(file->relname, ".psd")
593
 
                                ||      BLI_testextensie(file->relname, ".tif")
594
 
                                ||      BLI_testextensie(file->relname, ".tiff")
595
 
#endif
596
586
                                        ||      BLI_testextensie(file->relname, ".sgi")) {
597
587
                                        file->flags |= IMAGEFILE;                       
598
588
                                }
692
682
        if (sfile->filelist==0) return;
693
683
        
694
684
        for(; num>=0; num--){
695
 
                free(sfile->filelist[num].relname);
 
685
                MEM_freeN(sfile->filelist[num].relname);
696
686
                
697
 
                if (sfile->filelist[num].string) free(sfile->filelist[num].string);
 
687
                if (sfile->filelist[num].string) MEM_freeN(sfile->filelist[num].string);
698
688
        }
699
689
        free(sfile->filelist);
700
690
        sfile->filelist= 0;
851
841
        if(sfile->collums<1) sfile->collums= 1;
852
842
        else if(sfile->collums>8) sfile->collums= 8;
853
843
 
854
 
        if((U.flag & USER_FSCOLLUM)==0) if(sfile->type!=FILE_MAIN) sfile->collums= 1;
 
844
        /* this flag aint yet defined in user menu, needed? */
 
845
//      if((U.flag & USER_FSCOLLUM)==0) sfile->collums= 1;
855
846
        
856
847
        collumwidth= (textrct.xmax-textrct.xmin)/sfile->collums;
857
848
        
903
894
        
904
895
}
905
896
 
906
 
static void regelrect(int id, int x, int y)
 
897
static void linerect(int id, int x, int y)
907
898
{
908
899
        if(id & ACTIVE) {
909
900
                if(id & HILITE) BIF_ThemeColorShade(TH_HILITE, 20);
916
907
 
917
908
}
918
909
 
919
 
static void printregel(SpaceFile *sfile, struct direntry *files, int x, int y)
 
910
static void print_line(SpaceFile *sfile, struct direntry *files, int x, int y)
920
911
{
921
912
        int boxcol=0;
922
913
        char *s;
924
915
        boxcol= files->flags & (HILITE + ACTIVE);
925
916
 
926
917
        if(boxcol) {
927
 
                regelrect(boxcol, x, y);
 
918
                linerect(boxcol, x, y);
928
919
        }
929
920
 
930
921
        if(files->flags & BLENDERFILE) {
1006
997
}
1007
998
 
1008
999
 
1009
 
static int calc_filesel_regel(SpaceFile *sfile, int nr, int *valx, int *valy)
 
1000
static int calc_filesel_line(SpaceFile *sfile, int nr, int *valx, int *valy)
1010
1001
{
1011
 
        /* get screen coordinate of a 'regel', dutch for line */
 
1002
        /* get screen coordinate of a line */
1012
1003
        int val, coll;
1013
1004
 
1014
1005
        nr-= sfile->ofs;
1029
1020
static void set_active_file(SpaceFile *sfile, int act)
1030
1021
{
1031
1022
        struct direntry *file;
1032
 
        int num, redraw= 0, newflag;
 
1023
        int num, redraw= 0;
 
1024
        unsigned int newflag;
1033
1025
        int old=0, newi=0;
1034
1026
        
1035
1027
        file= sfile->filelist;
1063
1055
                }
1064
1056
                        
1065
1057
        }
1066
 
        
1067
 
        if(redraw==2) {
1068
 
                int x, y;
1069
 
                
1070
 
                glDrawBuffer(GL_FRONT);
1071
 
 
1072
 
                glScissor(curarea->winrct.xmin, curarea->winrct.ymin, curarea->winx-12, curarea->winy);
1073
 
 
1074
 
                if( calc_filesel_regel(sfile, old, &x, &y) ) {
1075
 
                        regelrect(0, x, y);
1076
 
                        printregel(sfile, sfile->filelist+old, x, y);
1077
 
                }
1078
 
                if( calc_filesel_regel(sfile, newi, &x, &y) ) {
1079
 
                        printregel(sfile, sfile->filelist+newi, x, y);
1080
 
                }
1081
 
                
1082
 
                glScissor(curarea->winrct.xmin, curarea->winrct.ymin, curarea->winx, curarea->winy);
1083
 
 
1084
 
                glFinish();             /* for geforce, to show it in the frontbuffer */
1085
 
                glDrawBuffer(GL_BACK);
1086
 
        }
1087
 
        else if(redraw) {
 
1058
        // removed frontbuffer draw here
 
1059
        if(redraw) {
1088
1060
                scrarea_queue_winredraw(curarea);
1089
1061
        }
1090
1062
}
1125
1097
        files= sfile->filelist+sfile->ofs;
1126
1098
        for(a= sfile->ofs; a<sfile->totfile; a++, files++) {
1127
1099
        
1128
 
                if( calc_filesel_regel(sfile, a, &x, &y)==0 ) break;
 
1100
                if( calc_filesel_line(sfile, a, &x, &y)==0 ) break;
1129
1101
                
1130
 
                printregel(sfile, files, x, y);
 
1102
                print_line(sfile, files, x, y);
1131
1103
        }
1132
1104
 
1133
1105
        /* clear drawing errors, with text at the right hand side: */
1152
1124
        glClearColor(col[0], col[1], col[2], 0.0); 
1153
1125
        glClear(GL_COLOR_BUFFER_BIT);
1154
1126
 
1155
 
        sfile= curarea->spacedata.first;        
1156
 
        if(sfile->filelist==0) {
 
1127
        sfile= sa->spacedata.first;     
 
1128
        if(sfile->filelist==NULL) {
1157
1129
                read_dir(sfile);
1158
1130
                
1159
1131
                calc_file_rcts(sfile);
1167
1139
        else calc_file_rcts(sfile);
1168
1140
 
1169
1141
        /* HEADER */
1170
 
        sprintf(name, "win %d", curarea->win);
1171
 
        block= uiNewBlock(&curarea->uiblocks, name, UI_EMBOSS, UI_HELV, curarea->win);
 
1142
        sprintf(name, "win %d", sa->win);
 
1143
        block= uiNewBlock(&sa->uiblocks, name, UI_EMBOSS, UI_HELV, sa->win);
1172
1144
        
1173
1145
        uiSetButLock( sfile->type==FILE_MAIN && sfile->returnfunc, NULL);
1174
1146
 
1200
1172
        draw_filetext(sfile);
1201
1173
        
1202
1174
        /* others diskfree etc ? */
1203
 
        scrarea_queue_headredraw(curarea);      
 
1175
        scrarea_queue_headredraw(sa);   
1204
1176
        
1205
1177
        myortho2(-0.375, (float)(sa->winx)-0.375, -0.375, (float)(sa->winy)-0.375);
1206
1178
        draw_area_emboss(sa);
1207
1179
        
1208
 
        curarea->win_swap= WIN_BACK_OK;
 
1180
        sa->win_swap= WIN_BACK_OK;
1209
1181
}
1210
1182
 
1211
1183
static void do_filescroll(SpaceFile *sfile)
1215
1187
        calc_file_rcts(sfile);
1216
1188
        
1217
1189
        filescrollselect= 1;
 
1190
        
1218
1191
        /* for beauty */
1219
 
 
1220
 
        glDrawBuffer(GL_FRONT);
1221
 
        draw_filescroll(sfile);
1222
 
        glDrawBuffer(GL_BACK);
 
1192
        scrarea_do_windraw(curarea);
 
1193
        screen_swapbuffers();
1223
1194
        
1224
1195
        getmouseco_areawin(mval);
1225
1196
        oldy= yo= mval[1];
1250
1221
        filescrollselect= 0;
1251
1222
 
1252
1223
        /* for beauty */
1253
 
        glDrawBuffer(GL_FRONT);
1254
 
        draw_filescroll(sfile);
1255
 
        glDrawBuffer(GL_BACK);
 
1224
        scrarea_do_windraw(curarea);
 
1225
        screen_swapbuffers();
1256
1226
        
1257
1227
}
1258
1228
 
1326
1296
        else if(type==FILE_LOADLIB) {
1327
1297
                strcpy(sfile->dir, name);
1328
1298
                if( is_a_library(sfile, temp, group) ) {
1329
 
                        /* to force a reload of the library-filelist */
1330
 
                        if(sfile->libfiledata==0) {
1331
 
                                freefilelist(sfile);
1332
 
                        }
 
1299
                        /* force a reload of the library-filelist */
 
1300
                        freefilelist(sfile);
1333
1301
                }
1334
1302
                else {
1335
1303
                        split_sfile(sfile, name);
1336
1304
                        if(sfile->libfiledata) BLO_blendhandle_close(sfile->libfiledata);
1337
 
                        sfile->libfiledata= 0;
 
1305
                        sfile->libfiledata= NULL;
1338
1306
                }
1339
1307
        }
1340
1308
        else {  /* FILE_BLENDER */
1515
1483
 
1516
1484
        if(sfile->type==FILE_LOADLIB) {
1517
1485
                do_library_append(sfile);
1518
 
                
 
1486
                BIF_undo_push("Append from file");
1519
1487
                allqueue(REDRAWALL, 1);
1520
1488
        }
1521
1489
        else if(sfile->returnfunc) {
1543
1511
                        sfile->returnfunc((char*) (long)sfile->retval);
1544
1512
                }
1545
1513
                else {
1546
 
                        if(strncmp(sfile->title, "SAVE", 4)==0) free_filesel_spec(sfile->dir);
 
1514
                        if(strncmp(sfile->title, "Save", 4)==0) free_filesel_spec(sfile->dir);
 
1515
                        if(strncmp(sfile->title, "Export", 6)==0) free_filesel_spec(sfile->dir);
1547
1516
                        
1548
1517
                        strcpy(name, sfile->dir);
1549
1518
                        strcat(name, sfile->file);
1832
1801
        sfile= curarea->spacedata.first;
1833
1802
        if(sfile==0) return;
1834
1803
        if(sfile->filelist==0) {
1835
 
                /* but do buttons */
1836
 
                if(val && event==LEFTMOUSE) {
1837
 
                        /* FrontbufferButs(TRUE); */
1838
 
                        /* event= DoButtons(); */
1839
 
                        /* FrontbufferButs(FALSE); */
1840
 
                                        /*  NIET de headerbuttons! */
1841
 
                        /* if(event) do_filesel_buttons(event, sfile); */
1842
 
                }
1843
1804
                return;
1844
1805
        }
1845
1806
        
1903
1864
                                        }
1904
1865
                                }
1905
1866
                        }
1906
 
                        else {
1907
 
                                /* FrontbufferButs(TRUE); */
1908
 
                                /* event= DoButtons(); */
1909
 
                                /* FrontbufferButs(FALSE); */
1910
 
                                        /*  NOT the headerbuttons! */
1911
 
                                /* if(event) do_filesel_buttons(event, sfile);   */
1912
 
                        }
1913
1867
                        break;
1914
1868
                case RIGHTMOUSE:
1915
1869
                        act= find_active_file(sfile, mval[0], mval[1]);
2187
2141
        char buf[32];
2188
2142
        char *lslash;
2189
2143
        
2190
 
        strcpy(buf, group);
 
2144
        BLI_strncpy(buf, group, 31);
2191
2145
        lslash= BLI_last_slash(buf);
2192
2146
        if (lslash)
2193
2147
                lslash[0]= '\0';
2283
2237
 
2284
2238
static void library_to_filelist(SpaceFile *sfile)
2285
2239
{
 
2240
        LinkNode *l, *names;
 
2241
        int ok, i, nnames, idcode;
 
2242
        char filename[FILE_MAXDIR+FILE_MAXFILE];
2286
2243
        char dir[FILE_MAXDIR], group[24];
2287
 
        int ok, i, nnames, idcode;
2288
 
        LinkNode *l, *names;
2289
2244
        
2290
2245
        /* name test */
2291
2246
        ok= is_a_library(sfile, dir, group);
2296
2251
                return;
2297
2252
        }
2298
2253
        
 
2254
        BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI
 
2255
        
2299
2256
        /* there we go */
2300
2257
        /* for the time being only read filedata when libfiledata==0 */
2301
2258
        if (sfile->libfiledata==0) {
2302
 
                sfile->libfiledata= BLO_blendhandle_from_file(dir);
 
2259
                sfile->libfiledata= BLO_blendhandle_from_file(dir);     // this sets G.sce, we dont want it
 
2260
                
2303
2261
                if(sfile->libfiledata==0) return;
2304
2262
        }
2305
2263
        
2319
2277
        sfile->filelist= malloc(sfile->totfile * sizeof(*sfile->filelist));
2320
2278
        memset(sfile->filelist, 0, sfile->totfile * sizeof(*sfile->filelist));
2321
2279
 
2322
 
        sfile->filelist[0].relname= strdup(".");
 
2280
        sfile->filelist[0].relname= BLI_strdup(".");
2323
2281
        sfile->filelist[0].type |= S_IFDIR;
2324
 
        sfile->filelist[1].relname= strdup("..");
 
2282
        sfile->filelist[1].relname= BLI_strdup("..");
2325
2283
        sfile->filelist[1].type |= S_IFDIR;
2326
2284
                
2327
2285
        for (i=0, l= names; i<nnames; i++, l= l->next) {
2328
 
                char *blockname= l->link;
 
2286
                char *blockname= BLI_strdup(l->link); 
2329
2287
 
2330
2288
                sfile->filelist[i + 2].relname= blockname;
2331
2289
                if (!idcode)
2332
2290
                        sfile->filelist[i + 2].type |= S_IFDIR;
2333
2291
        }
2334
2292
                
2335
 
        BLI_linklist_free(names, NULL);
 
2293
        BLI_linklist_free(names, free);
2336
2294
        
2337
2295
        qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
2338
2296
        
2342
2300
                if (len > sfile->maxnamelen)
2343
2301
                        sfile->maxnamelen = len;
2344
2302
        }
 
2303
        
 
2304
        BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change
 
2305
 
2345
2306
}
2346
2307
 
2347
2308
/* ******************* DATA SELECT ********************* */
2372
2333
                        base->flag= base->object->flag;
2373
2334
                        base= base->next;
2374
2335
                }
 
2336
                countall();
2375
2337
                allqueue(REDRAWVIEW3D, 0);
2376
2338
        }
2377
2339
        else if( strcmp(sfile->dir, "Scene/")==0 ) {
2440
2402
                        sfile->filelist[a].type |= S_IFDIR;
2441
2403
                }
2442
2404
                
2443
 
                sfile->filelist[0].relname= strdup("..");
2444
 
                sfile->filelist[1].relname= strdup(".");
2445
 
                sfile->filelist[2].relname= strdup("Scene");
2446
 
                sfile->filelist[3].relname= strdup("Object");
2447
 
                sfile->filelist[4].relname= strdup("Mesh");
2448
 
                sfile->filelist[5].relname= strdup("Curve");
2449
 
                sfile->filelist[6].relname= strdup("Metaball");
2450
 
                sfile->filelist[7].relname= strdup("Material");
2451
 
                sfile->filelist[8].relname= strdup("Texture");
2452
 
                sfile->filelist[9].relname= strdup("Image");
2453
 
                sfile->filelist[10].relname= strdup("Ika");
2454
 
                sfile->filelist[11].relname= strdup("Wave");
2455
 
                sfile->filelist[12].relname= strdup("Lattice");
2456
 
                sfile->filelist[13].relname= strdup("Lamp");
2457
 
                sfile->filelist[14].relname= strdup("Camera");
2458
 
                sfile->filelist[15].relname= strdup("Ipo");
2459
 
                sfile->filelist[16].relname= strdup("World");
2460
 
                sfile->filelist[17].relname= strdup("Screen");
2461
 
                sfile->filelist[18].relname= strdup("VFont");
2462
 
                sfile->filelist[19].relname= strdup("Text");
2463
 
                sfile->filelist[20].relname= strdup("Armature");
2464
 
                sfile->filelist[21].relname= strdup("Action");
 
2405
                sfile->filelist[0].relname= BLI_strdup("..");
 
2406
                sfile->filelist[1].relname= BLI_strdup(".");
 
2407
                sfile->filelist[2].relname= BLI_strdup("Scene");
 
2408
                sfile->filelist[3].relname= BLI_strdup("Object");
 
2409
                sfile->filelist[4].relname= BLI_strdup("Mesh");
 
2410
                sfile->filelist[5].relname= BLI_strdup("Curve");
 
2411
                sfile->filelist[6].relname= BLI_strdup("Metaball");
 
2412
                sfile->filelist[7].relname= BLI_strdup("Material");
 
2413
                sfile->filelist[8].relname= BLI_strdup("Texture");
 
2414
                sfile->filelist[9].relname= BLI_strdup("Image");
 
2415
                sfile->filelist[10].relname= BLI_strdup("Ika");
 
2416
                sfile->filelist[11].relname= BLI_strdup("Wave");
 
2417
                sfile->filelist[12].relname= BLI_strdup("Lattice");
 
2418
                sfile->filelist[13].relname= BLI_strdup("Lamp");
 
2419
                sfile->filelist[14].relname= BLI_strdup("Camera");
 
2420
                sfile->filelist[15].relname= BLI_strdup("Ipo");
 
2421
                sfile->filelist[16].relname= BLI_strdup("World");
 
2422
                sfile->filelist[17].relname= BLI_strdup("Screen");
 
2423
                sfile->filelist[18].relname= BLI_strdup("VFont");
 
2424
                sfile->filelist[19].relname= BLI_strdup("Text");
 
2425
                sfile->filelist[20].relname= BLI_strdup("Armature");
 
2426
                sfile->filelist[21].relname= BLI_strdup("Action");
2465
2427
                qsort(sfile->filelist, sfile->totfile, sizeof(struct direntry), compare_name);
2466
2428
        }
2467
2429
        else {
2491
2453
                
2492
2454
                if(sfile->returnfunc==0) {
2493
2455
                        memset( &(sfile->filelist[0]), 0 , sizeof(struct direntry));
2494
 
                        sfile->filelist[0].relname= strdup(".");
 
2456
                        sfile->filelist[0].relname= BLI_strdup(".");
2495
2457
                        sfile->filelist[0].type |= S_IFDIR;
2496
2458
                        memset( &(sfile->filelist[1]), 0 , sizeof(struct direntry));
2497
 
                        sfile->filelist[1].relname= strdup("..");
 
2459
                        sfile->filelist[1].relname= BLI_strdup("..");
2498
2460
                        sfile->filelist[1].type |= S_IFDIR;
2499
2461
                
2500
2462
                        files+= 2;
2514
2476
                        if(ok) {
2515
2477
                
2516
2478
                                memset( files, 0 , sizeof(struct direntry));
2517
 
                                files->relname= strdup(id->name+2);
 
2479
                                files->relname= BLI_strdup(id->name+2);
2518
2480
                                
2519
2481
                                if(sfile->returnfunc==0) { /* F4 DATA BROWSE */
2520
2482
                                        if(idcode==ID_OB) {