--- a/Utilities/FtpUtilities.py Wed Sep 19 18:21:04 2012 +0200 +++ b/Utilities/FtpUtilities.py Wed Sep 19 20:19:49 2012 +0200 @@ -7,6 +7,8 @@ Module implementing some FTP related utilities. """ +import os + from PyQt4.QtCore import QObject, QDate, QDateTime, QTime from PyQt4.QtNetwork import QUrlInfo @@ -99,11 +101,15 @@ if modeString[0] == "d": urlInfo.setDir(True) urlInfo.setFile(False) + urlInfo.setSymLink(False) elif modeString[0] == "l": + urlInfo.setDir(False) + urlInfo.setFile(False) urlInfo.setSymLink(True) elif modeString[0] == "-": - urlInfo.setDir(False) + urlInfo.setDir(True) urlInfo.setFile(True) + urlInfo.setSymLink(False) def __parseUnixTime(self, monthAbbreviation, day, yearOrTime, urlInfo): """ @@ -271,6 +277,16 @@ raise FtpDirLineParserError("illegal size '{0}'".format(dirOrSize)) urlInfo.setName(name) + ext = os.path.splitext(name.lower())[1] + urlInfo.setSymLink(ext == ".lnk") + + permissions = (QUrlInfo.ReadOwner | QUrlInfo.WriteOwner + | QUrlInfo.ReadGroup | QUrlInfo.WriteGroup + | QUrlInfo.ReadOther | QUrlInfo.WriteOther) + if ext in [".exe", ".com", ".bat", ".cmd"]: + permissions |= QUrlInfo.ExeOwner | QUrlInfo.ExeGroup | QUrlInfo.ExeOther + urlInfo.setPermissions(permissions) + return urlInfo def parseLine(self, line):