浏览代码

Add function to extract basename from url

Andrej 4 年之前
父节点
当前提交
ae00b7e243
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      labkeyFileBrowser.py

+ 10 - 1
labkeyFileBrowser.py

@@ -101,4 +101,13 @@ class labkeyFileBrowser:
     def mkdir(self,url):
         self.net.mkcol(url)
 
-        
+
+#listing helping functions
+    def baseDir(self,remotePath):
+        #strip potential trailing slash
+        if remotePath[-1]=='/':
+            remotePath=remotePath[:-1]
+        #find last slash
+        if remotePath.rfind('/')>-1:
+            remotePath=remotePath[remotePath.rfind('/')+1:]
+        return remotePath