From 776544e63ed9a7a2c90c6b26f847b18882ee5146 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 27 May 2013 20:01:04 +0200 Subject: Missing SEP conversions. --- plugingui/directory.cc | 11 ++++++++--- plugingui/directory.h | 2 ++ plugingui/filebrowser.cc | 8 ++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/plugingui/directory.cc b/plugingui/directory.cc index 18ec336..85e34aa 100644 --- a/plugingui/directory.cc +++ b/plugingui/directory.cc @@ -58,6 +58,11 @@ Directory::~Directory() { } +std::string Directory::seperator() +{ + return SEP; +} + void Directory::setPath(std::string path) { DEBUG(directory, "Setting path to '%s'\n", path.c_str()); @@ -149,7 +154,7 @@ Directory::EntryList Directory::listFiles(std::string path) entrypath += entry->d_name; if(Directory::isDir(entrypath)) { if(name == "..") directories.push_back(entry->d_name); - else directories.push_back(std::string("/") + entry->d_name); + else directories.push_back(std::string(SEP) + entry->d_name); } else { int drumkit_suffix_length = strlen(DRUMKIT_SUFFIX); @@ -223,7 +228,7 @@ bool Directory::isRoot(std::string path) return false; } #else - if(path == "/") return true; + if(path == SEP) return true; else return false; #endif } @@ -242,7 +247,7 @@ std::string Directory::root(std::string path) return path.substr(0, 2); } #else - return "/"; + return SEP; #endif } diff --git a/plugingui/directory.h b/plugingui/directory.h index 9e184d4..50d5fae 100644 --- a/plugingui/directory.h +++ b/plugingui/directory.h @@ -50,6 +50,8 @@ class Directory { Directory(std::string path); ~Directory(); + std::string seperator(); + size_t count(); void refresh(); std::string path(); diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index 9d5ae35..fcd4b9c 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -76,11 +76,11 @@ static void changeDir(void *ptr) lb->clear(); INFO(filebrowser, "Changing path to '%s'\n", - (dir->path() + "/" + value).c_str()); + (dir->path() + dir->seperator() + value).c_str()); #ifdef WIN32 if(prv->above_root && !value.empty()) { - dir->setPath(value+"\\"); + dir->setPath(value + dir->seperator()); value.clear(); prv->above_root = false; } @@ -93,7 +93,7 @@ static void changeDir(void *ptr) } if(!value.empty() && dir->fileExists(value)) { - std::string file = dir->path() + "/" + value; + std::string file = dir->path() + dir->seperator() + value; DEBUG(filebrowser, "Selecting file '%s'\n", file.c_str()); if(prv->filesel_handler) prv->filesel_handler(prv->ptr, file); return; @@ -119,7 +119,7 @@ static void changeDir(void *ptr) if(!value.empty() && !dir->cd(value)) { DEBUG(filebrowser, "Error changing to '%s'\n", - (dir->path() + "/" + value).c_str()); + (dir->path() + dir->seperator() + value).c_str()); return; } -- cgit v1.2.3