plan9: introduce absolute_path, add todos
authorDaniel Mendler <mail@daniel-mendler.de>
Tue, 10 Feb 2015 07:52:22 +0000 (08:52 +0100)
committerDaniel Mendler <mail@daniel-mendler.de>
Tue, 10 Feb 2015 07:52:22 +0000 (08:52 +0100)
src/libs/Network/uip/plan9/plan9.cpp
src/libs/utils.cpp

index 60d3f2d..de3d2ab 100644 (file)
@@ -307,10 +307,18 @@ void send_error(const char* text)
     uip_send(msg, msg->size);
 }
 
+// TODO: Move to utils
+inline std::string absolute_path(const std::string& path)
+{
+    // TODO: remove /../ and /./ from paths
+    return path;
+}
+
+// TODO: Move to utils
 std::string join_path(const std::string& a, const std::string& b)
 {
-    return a.back() != '/' ? absolute_from_relative(a + "/" + b) :
-            absolute_from_relative(a + b);
+    return a.back() != '/' ? absolute_path(a + "/" + b) :
+            absolute_path(a + b);
 }
 
 } // anonymous namespace
@@ -320,7 +328,7 @@ Plan9::~Plan9() {}
 
 Plan9::Entry* Plan9::get_entry(uint8_t type, const std::string& path)
 {
-    std::string abspath = absolute_from_relative(path);
+    std::string abspath = absolute_path(path);
     auto i = entries.find(abspath);
     if (i != entries.end())
         return &(i->second);
index 0168a29..6c30a86 100644 (file)
@@ -167,6 +167,7 @@ void system_reset( bool dfu )
 }
 
 // Convert a path indication ( absolute or relative ) into a path ( absolute )
+// TODO: Combine with plan9 absolute_path, current_path as argument?
 string absolute_from_relative( string path )
 {
     string cwd = THEKERNEL->current_path;