Bug 785108 - Fix devicemanagerADB's isDir to handle symbolic links properly;r=jmaher DONTBUILD
authorWilliam Lachance <wlachance@mozilla.com>
Thu, 23 Aug 2012 15:56:18 -0400
changeset 105251 e53c5799835032cc436209da3194d3b43474d524
parent 105250 0a7b2834337b53afb19e895aaa4de56d7a0edeb7
child 105252 bb414dc59262f90ea68031b6e0034ff952e56c03
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersjmaher
bugs785108
milestone17.0a1
Bug 785108 - Fix devicemanagerADB's isDir to handle symbolic links properly;r=jmaher DONTBUILD
build/mobile/devicemanagerADB.py
--- a/build/mobile/devicemanagerADB.py
+++ b/build/mobile/devicemanagerADB.py
@@ -285,27 +285,24 @@ class DeviceManagerADB(DeviceManager):
               else:
                   out += self.removeFile(remoteDir.strip() + "/" + f.strip())
           out += self.removeSingleDir(remoteDir.strip())
       else:
           out += self.removeFile(remoteDir.strip())
       return out
 
   def isDir(self, remotePath):
-      p = self.runCmd(["shell", "ls", "-a", remotePath])
+      p = self.runCmd(["shell", "ls", "-a", remotePath + '/'])
+
       data = p.stdout.readlines()
-      if (len(data) == 0):
-          return True
-      if (len(data) == 1):
-          if (data[0].rstrip() == remotePath):
+      if len(data) == 1:
+          res = data[0]
+          if "Not a directory" in res or "No such file or directory" in res:
               return False
-          if (data[0].find("No such file or directory") != -1):
-              return False
-          if (data[0].find("Not a directory") != -1):
-              return False
+
       return True
 
   def listFiles(self, rootdir):
       p = self.runCmd(["shell", "ls", "-a", rootdir])
       data = p.stdout.readlines()
       data[:] = [item.rstrip('\r\n') for item in data]
       if (len(data) == 1):
           if (data[0] == rootdir):