From: John Tsiombikas Date: Wed, 3 Aug 2016 06:22:07 +0000 (+0300) Subject: Merge branch 'master' of goat:git/vrfileman X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=commitdiff_plain;h=eb234b8984132f68fffec0ea5f8a314d6d36f7bb;hp=20f18dc9afa4e7a9efb6253edce231f664d14215 Merge branch 'master' of goat:git/vrfileman --- diff --git a/src/fs.cc b/src/fs.cc index a3e5b81..d6b5eeb 100644 --- a/src/fs.cc +++ b/src/fs.cc @@ -37,7 +37,9 @@ bool init_fs(const char *path) return false; } - cur_node = get_fsnode(path); + if(!(cur_node = get_fsnode(path))) { + return false; + } cur_node->expand(); return true; } @@ -50,6 +52,7 @@ void cleanup_fs() delete node; } node_cache.clear(); + dtx_close_font(fat_font); delete iconrend; } @@ -72,12 +75,12 @@ static float icon_angle(int col, int ncols, float max_angle = 0.0f) 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(1, umax * 16); + int max_ncols = std::max(1, umax * 12); Mat4 base_xform; base_xform.rotate(time_sec, 0, 0); diff --git a/src/fspath.cc b/src/fspath.cc index e6677bd..eb923d6 100644 --- a/src/fspath.cc +++ b/src/fspath.cc @@ -128,6 +128,8 @@ FSPath &FSPath::operator =(FSPath &&p) void FSPath::sanitize() { + printf("sanitize: \"%s\"\n", abs_path); + // first pass, convert and backslashes to slashes char *s = abs_path; while(*s) { @@ -163,8 +165,8 @@ void FSPath::sanitize() } 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)); @@ -192,7 +194,11 @@ void FSPath::sanitize() 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);