summaryrefslogtreecommitdiff
path: root/plugingui/directory.cc
diff options
context:
space:
mode:
authorjsc@umbraculum.org <jsc@umbraculum.org>2013-04-26 11:05:11 +0200
committerjsc@umbraculum.org <jsc@umbraculum.org>2013-04-26 11:05:11 +0200
commit5e2e2a6b4eed3a06a048f2ea1c609b2bb9659a5a (patch)
treec772952c039620312e14254335f52725a9bc0de6 /plugingui/directory.cc
parent4cb91eb29feb454c3e7162100508a2ea64b3ab6a (diff)
Is capable of selecting a file.
Diffstat (limited to 'plugingui/directory.cc')
-rw-r--r--plugingui/directory.cc36
1 files changed, 32 insertions, 4 deletions
diff --git a/plugingui/directory.cc b/plugingui/directory.cc
index 9515060..5f80508 100644
--- a/plugingui/directory.cc
+++ b/plugingui/directory.cc
@@ -53,9 +53,12 @@ void Directory::refresh() {
bool Directory::cd(std::string dir) {
DEBUG(directory, "Changing to '%s'\n", dir.c_str());
- int r = chdir(dir.c_str());
- refresh();
- if(!r) return true;
+ int r = chdir( (path() + "/" + dir).c_str() );
+ if(!r) {
+ _path += "/" + dir;
+ refresh();
+ return true;
+ }
else return false;
}
@@ -81,7 +84,32 @@ std::string Directory::cwd() {
}
std::string Directory::cleanPath(std::string path) {
- // TODO!
+/*
+ size_t c = 0;
+ std::string current_char;
+ std::string prev_char;
+
+ for(; c < path.size(); c++) {
+ current_char = path.at(c);
+ prev_char = current_char;
+ }
+*/
+/*
+
+ size_t current_pos;
+ size_t prev_pos = 1;
+ DEBUG(directory, "Looking at path '%s'\n", path.c_str());
+ while( (current_pos = path.find("/", prev_pos + 1)) != std::string::npos) {
+ DEBUG(directory, "%d - %d", prev_pos, current_pos);
+ std::string dir = path.substr(prev_pos, current_pos - prev_pos + 1);
+ DEBUG(directory, "Dir '%s'\n", dir.c_str());
+ prev_pos = current_pos;
+ }
+
+ std::string dir = path.substr(prev_pos, current_pos - prev_pos + 1);
+ DEBUG(directory, "Dir '%s'\n", dir.c_str());
+*/
+
return path;
}