7 #include "gmath/gmath.h"
11 static IconRenderer *iconrend;
15 iconrend = new ShapesIcons;
16 if(!iconrend->init()) {
31 test.type = FSNODE_DIR;
34 xform.rotate(time_sec, 0, 0);
35 xform.rotate(0, 0, time_sec * 0.5);
36 xform.translate(0, 2, -5);
39 glMultMatrixf(xform[0]);
42 glDisable(GL_TEXTURE_2D);
43 iconrend->draw(&test);
48 // ---- FSNode implementation ----
51 type = FSNODE_UNKNOWN;
52 abs_path = name = suffix = 0;
62 void FSNode::set_path(const char *s)
69 const char *slash = s + len - 1;
70 while(slash > s && *slash != '/') {
73 if(name == s) { // no slashes found
75 if(!getcwd(buf, sizeof buf)) {
79 int dirlen = strlen(buf);
80 abs_path = new char[len + dirlen + 2];
81 sprintf(abs_path, "%s/%s", buf, s);
83 name = abs_path + dirlen + 1;
84 suffix = abs_path + len + dirlen - 1;
86 abs_path = new char[len + 1];
87 memcpy(abs_path, s, len + 1);
89 name = abs_path + (slash - s);
90 suffix = abs_path + len - 1;
93 while(suffix > name && *suffix != '.') {