return false;
}
- cur_node = get_fsnode(path);
+ if(!(cur_node = get_fsnode(path))) {
+ return false;
+ }
cur_node->expand();
return true;
}
delete node;
}
node_cache.clear();
+ dtx_close_font(fat_font);
delete iconrend;
}
void draw_fs()
{
- static const float row_spacing = 2.0;
+ static const float row_spacing = 0.25;
static const float radius = 0.6;
static const float umax = 0.42;
static const float max_icon_angle = M_PI * 2.0 * umax;
- int max_ncols = std::max<int>(1, umax * 16);
+ int max_ncols = std::max<int>(1, umax * 12);
Mat4 base_xform;
base_xform.rotate(time_sec, 0, 0);
void FSPath::sanitize()
{
+ printf("sanitize: \"%s\"\n", abs_path);
+
// first pass, convert and backslashes to slashes
char *s = abs_path;
while(*s) {
}
assert(len == (int)strlen(abs_path));
- // remove trailing slash
- if(abs_path[len - 1] == '/') {
+ // remove trailing slash if abs_path is not just a slash (root)
+ if(len > 1 && abs_path[len - 1] == '/') {
abs_path[--len] = 0;
}
assert(len == (int)strlen(abs_path));
parent = 0; // root dir has no parent
} else {
int plen = name - 1 - abs_path;
- assert(plen > 0);
+ assert(plen >= 0);
+
+ if(plen == 0) {
+ plen = 1; // our parent is root, so we need the slash
+ }
parent = new char[plen + 1];
memcpy(parent, abs_path, plen);