summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNullspoon <nullspoon@iohq.net>2014-08-03 19:58:02 -0600
committerNullspoon <nullspoon@iohq.net>2014-08-03 19:58:02 -0600
commit102d8d58065a6a9794a45573e975fd5ce6c592d5 (patch)
tree1fcd84a3e4092e3defcf49c78bafee75ae0c7662
parentb15cb2b4e9ff75aeb1b8bf5344d473be528f3c3e (diff)
downloadnoteless-102d8d58065a6a9794a45573e975fd5ce6c592d5.tar.gz
noteless-102d8d58065a6a9794a45573e975fd5ce6c592d5.tar.xz
Fixed bug in Path with multiple slashes
Multiple slashes weren't expected in the path class, so having them was throwing off filename parsing (for each slash, one char off the front of the filename was being removed). This fix finds consecutive path delimiters and ignores them until the actual path resumes.
-rw-r--r--src/lib/path.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/path.cpp b/src/lib/path.cpp
index 13b91a7..c51fc9f 100644
--- a/src/lib/path.cpp
+++ b/src/lib/path.cpp
@@ -29,10 +29,13 @@ path::path( string p ) {
// Skip the first if it's an absolute path
if( i == 0 && p[i] == delim ) { continue; }
if( p[i] == delim ) {
+ // Handle multiple consecutive delimiters.
+ if( p[i + 1] == delim ) {
+ continue;
+ }
// Check if we've hit a path delimiter (/ or \)
dirs.push_back( p.substr( cur_dir_begin, i - cur_dir_begin ) );
// Skip the slash since we don't need it
- i++;
cur_dir_begin = i;
}
}

Generated by cgit