From 1c994463116c3427589188e5f15e117d44bc188e Mon Sep 17 00:00:00 2001 From: David Date: Tue, 6 Sep 2016 11:11:00 -0500 Subject: [PATCH] fixed root directory bug in stim::filename --- stim/parser/filename.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/stim/parser/filename.h b/stim/parser/filename.h index 7baf900..0188f92 100644 --- a/stim/parser/filename.h +++ b/stim/parser/filename.h @@ -110,12 +110,17 @@ protected: unix_dir = unix_dir.substr(2, unix_dir.length()-2); //extract the directory structure } - if(unix_dir[0] == '/'){ //if there is a leading slash - relative = false; //the path is not relative - unix_dir = unix_dir.substr(1, unix_dir.length() - 1); //remove the slash + if(drive.size() != 0){ + relative = false; + } + if(unix_dir.size() > 0){ //if there is a directory specified, remove surrounding slashes + if(unix_dir[0] == '/'){ //if there is a leading slash + relative = false; //the path is not relative + unix_dir = unix_dir.substr(1, unix_dir.length() - 1); //remove the slash + } + if(unix_dir[unix_dir.size()-1] == '/') + unix_dir = unix_dir.substr(0, unix_dir.length() - 1); } - if(unix_dir[unix_dir.size()-1] == '/') - unix_dir = unix_dir.substr(0, unix_dir.length() - 1); path = stim::parser::split(unix_dir, '/'); //split up the directory structure -- libgit2 0.21.4